我有一个在 Ubuntu 16.04 托管构建代理上运行在 Azure DevOps 中的构建。我正在使用最新版本的“Azure Powershell”任务(版本 4.* 预览版),它应该是多平台的,支持 Powershell 核心,并支持使用Azure Powershell Az 模块。
但是,它并不完全奏效。在运行我的任何脚本之前,它会出错:
##[section]Starting: Azure PowerShell script: InlineScript
==============================================================================
Task : Azure PowerShell
Description : Run a PowerShell script within an Azure environment
Version : 4.0.0
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613749)
==============================================================================
##[warning]Can\'t find loc string for key: GeneratingScript
GeneratingScript
[command]/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/home/vsts/work/_temp/e66222aa-283d-4dfd-b5c1-f1d2a4a3ba9f.ps1'
Could not find the module Az.Accounts with given version. If the module was recently installed, retry after restarting the Azure Pipelines task agent.
At /home/vsts/work/_tasks/AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62/4.0.0/InitializeAz.ps1:25 char:5
+ throw ("Could not find the module Az.Accounts with given version. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Could not find ...nes task agent.:String) [], RuntimeException
+ FullyQualifiedErrorId : Could not find the module Az.Accounts with given version. If the module was recently installed, retry after restarting the Azure Pipelines task agent.
##[error]PowerShell exited with code '1'.
##[error]PowerShell wrote one or more lines to the standard error stream.
##[section]Finishing: Azure PowerShell script: InlineScript
Az Powershell 模块似乎在 Windows VS2017 托管代理上正常工作/加载,但在 Ubuntu 上没有运气。有关解决此问题的任何建议吗?