我正在使用 AzurePowershell@5 任务运行 powershell 脚本,该脚本将构建模板规范并将其推送到资源组。我正在使用 azurerm 服务连接进行身份验证。这是任务详细信息:
- task: AzurePowershell@5
displayName: Template Spec Generation
inputs:
azureSubscription: 'azurerm service principal'
scriptType: filePath
scriptPath: $(Build.SourcesDirectory)\src\sxript.ps1
scriptArguments:
-resourceGroupName <name> `
-location eastus `
-overrideVersion true `
-isTagged true `
-tag test `
-outputPath output.json
azurePowerShellVersion: latestVersion
pwsh: true
但是我在运行此任务时遇到以下错误:
##[错误]找不到模块:“Az.Accounts”,版本:“”。如果最近安装了该模块,请重新启动 Azure 后重试 管道任务代理。 ##[错误]PowerShell 退出,代码为“1”。
有人可以帮忙吗?