azure - 如何在azure devops管道中执行azure cli命令

标签 azure azure-devops azure-pipelines azure-cli

要在 Azure CLI 中执行 ACR 命令,我们需要升级 AZ CLI。需要在 YML 中有完整的步骤才能在管道中执行 AZ 命令。

最佳答案

请引用链接:https://learn.microsoft.com/en-us/azure/devops/cli/azure-devops-cli-in-yaml?view=azure-devops

对于 Linux:azure-pipelines-steps-linux.yml:

步骤:

更新到最新的 Azure CLI 版本。

  • 脚本:pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge displayName: '升级 azure cli'

  • 脚本:az --version displayName: '显示 Azure CLI 版本'

  • 脚本:az 扩展添加 -n azure-devops displayName: '安装 Azure DevOps 扩展'

  • 任务:AzureCLI@2 输入: azure订阅:“AzureServiceConnection” 脚本类型:bash 脚本位置:'内联脚本' 内联脚本: | az 帐户显示

关于azure - 如何在azure devops管道中执行azure cli命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67429607/

相关文章:

node.js - Azure NPM 问题 : msnodesql Fails to deploy

c# - Azure Function 部署后不工作

使用错误版本的包的 Azure DevOps 构建解决方案

visual-studio - 在 VSTS/Azure devops 中提交时如何排除更改?

kubernetes - 如何在 Azure 管道 (VSTS) 中使用 Deploy to Kubernetes 任务的输出变量

shell - 如何在 Azure Devops 管道中再次循环一种对象类型参数

git - Azure Devops pull 请求完成时发生冲突

azure - 逻辑应用 - 将 Blob 文件复制到本地服务器

unit-testing - VSTS : dotnet with Docker fail to publish tests

azure - 如何将变量从子管道传递到主管道?