简体   繁体   English

在 Azure DevOps 管道中运行 Azure powershell 命令

[英]Run Azure powershell commands in Azure devops pipeline

在此处输入图片说明 What I should do to run the Azure powershell commands against release pipeline.我应该怎么做才能针对发布管道运行 Azure powershell 命令。 When i try to run the Azure powershell command in the "Inline Azure Powershell" i am getting below error.当我尝试在“内联 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.

I am using Hosted agent provided by the Azure pipeline我正在使用 Azure 管道提供的托管代理

There has 2 method.有2种方法。

Suggest you use Azure Powershell Task and change to Inline type.建议您使用Azure Powershell Task并更改为Inline类型。

First method is change the Azure Powershell Task version to 4.* .第一种方法是将Azure Powershell 任务版本更改为4.* In 4.* , we build-in the Az.KeyVault module.4.* ,我们内置Az.KeyVault模块。 And it will download the corresponding dll to support this command use.并且会下载对应的dll来支持这个命令的使用。

在此处输入图片说明


Or you can continue to use 1.* version task.或者您可以继续使用1.*版本任务。 Just run赶紧跑

Install-Module Az.KeyVault

command firstly to prepare the environment.命令首先准备环境。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM