运行 Azure devops 管道中的 Azure powershell 命令

Run Azure powershell commands in Azure devops pipeline

我应该对 运行 针对发布管道的 Azure powershell 命令做些什么。当我尝试 运行 "Inline Azure Powershell" 中的 Azure powershell 命令时,出现以下错误。

##[error]The term 'Get-AzKeyVaultSecret' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

我正在使用 Azure 管道提供的托管代理

有2种方法。

建议您使用Azure Powershell Task并更改为Inline类型。

第一种方法是将 Azure Powershell Task 版本更改为 4.*。在 4.* 中,我们 内置 Az.KeyVault 模块。并且会下载相应的dll来支持该命令的使用。


或者您可以继续使用1.*版本任务。就 运行

Install-Module Az.KeyVault

命令先准备环境