在Azure devops管道中运行Azure Powershell命令

时间:2019-12-09 10:45:59

标签: powershell azure-devops azure-pipelines azure-pipelines-release-pipeline

enter image description here我应该怎么做才能针对发布管道运行Azure powershell命令。当我尝试在“嵌入式​​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管道提供的托管代理

1 个答案:

答案 0 :(得分:1)

有2种方法。

建议您使用 Azure Powershell任务,然后更改为内联类型。

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

enter image description here


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

Install-Module Az.KeyVault

首先

命令准备环境。

相关问题