0

我想在 ADO 的自托管代理池中安装 Az.ManagedServiceIdentity。它是否需要访问权限以及 Az.Connect 和 Az.Account 命令。我想使用以下命令创建用户分配的身份 - New-AzUserAssignedIdentity -ResourceGroupName PSRG -Name ID1 [我指的是这个链接 - https://docs.microsoft.com/en-us/powershell/module/az.managedserviceidentity /new-azuserassignedidentity?view=azps-5.8.0#examples] 但是出现错误,该命令无法识别。此外,此命令也不适用于 Azure 代理池,并且我遇到了同样的错误。安装 Az.ManagedServiceIdentity 模块的依赖项是什么。

4

2 回答 2

0

请为此使用Azure PowerShell 任务

此任务用于在 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
于 2021-04-27T09:21:40.530 回答
0

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

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

于 2021-04-28T08:01:21.223 回答