Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure powershell 如何在ADO中的自托管代理池中安装模块Az.ManagedServiceIdentity_Azure Powershell_Azure Identity - Fatal编程技术网

Azure powershell 如何在ADO中的自托管代理池中安装模块Az.ManagedServiceIdentity

Azure powershell 如何在ADO中的自托管代理池中安装模块Az.ManagedServiceIdentity,azure-powershell,azure-identity,Azure Powershell,Azure Identity,我想在ADO中的自托管代理池中安装Az.ManagedServiceIdentity。 它是否需要access和Az.Connect以及Az.Account命令。 我想使用下面的命令创建一个用户分配的标识- 新AzUserAssignedIdentity-ResourceGroupName PSRG-Name ID1 [我指的是这个链接-https://docs.microsoft.com/en-us/powershell/module/az.managedserviceidentity/new

我想在ADO中的自托管代理池中安装Az.ManagedServiceIdentity。 它是否需要access和Az.Connect以及Az.Account命令。 我想使用下面的命令创建一个用户分配的标识- 新AzUserAssignedIdentity-ResourceGroupName PSRG-Name ID1 [我指的是这个链接-https://docs.microsoft.com/en-us/powershell/module/az.managedserviceidentity/new-azuserassignedidentity?view=azps-5.8.0#示例] 但该命令无法识别的错误。 此外,此命令在Azure代理池上也不起作用,我收到了相同的错误。 安装Az.ManagedServiceIdentity模块的依赖项是什么。

请使用

此任务用于在Azure中运行PowerShell脚本 环境Azure上下文通过提供的 Azure资源管理器服务连接

YAML代码片段:

# Azure PowerShell
# Run a PowerShell script within an Azure environment
- task: AzurePowerShell@5
  inputs:
    #azureSubscription: Required. Name of Azure Resource Manager service connection
    #scriptType: 'FilePath' # Optional. Options: filePath, inlineScript
    #scriptPath: # Optional
    #inline: '# You can write your Azure PowerShell scripts inline here. # You can also pass predefined and custom variables to this script using arguments' # Optional
    #scriptArguments: # Optional
    #errorActionPreference: 'stop' # Optional. Options: stop, continue, silentlyContinue
    #failOnStandardError: false # Optional
    #azurePowerShellVersion: 'OtherVersion' # Required. Options: latestVersion, otherVersion
    #preferredAzurePowerShellVersion: # Required when azurePowerShellVersion == OtherVersion
    #pwsh: true # Optional. If true, then will use PowerShell Core pwsh.exe

感谢Yogesh Kulkarni分享重新启动代理池,使其能够找到新软件。似乎需要重新启动才能找到新安装的软件,然后将其注册到服务中


顺便说一句,正如singhh msft回答的那样,建议使用在Azure环境中运行PowerShell脚本。

是的,它需要access和Az.Connect和Az.Account命令,只有您正确登录,您才可以自由使用这些命令,不需要自托管代理池来执行某些操作。您应该在管道中使用。因此,在ADO中,它将如何使用Az.connect和Az.Account命令,因为我正在使用服务主体来运行新的AzUserAssignedIdentity命令。此外,我在其中一个代理池上安装了模块,但仍然收到一个错误,即新的AzUserAssignedIdentity未被识别为cmdlet的名称,功能……你呢?如果是,您能否成功地在本地运行这些命令?使用Get Installed Module,我获得了安装在代理池上的所有AZ模块的列表,其中还显示了AZ.ManagedServiceIdentity modlue和0.7.3