要在 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/