简体   繁体   English

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

[英]how to execute azure cli command in azure devops pipeline

To execute ACR commands in Azure CLI, we need upgrade AZ CLI.要在 Azure CLI 中执行 ACR 命令,我们需要升级 AZ CLI。 Need to have complete steps in YML to execute the AZ commands in pipeline.需要在 YML 中有完整的步骤才能在管道中执行 AZ 命令。

Please refer link: https://docs.microsoft.com/en-us/azure/devops/cli/azure-devops-cli-in-yaml?view=azure-devops请参考链接: https://docs.microsoft.com/en-us/azure/devops/cli/azure-devops-cli-in-yaml?view=azure-devops

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

steps:脚步:

Updating to latest Azure CLI version.更新到最新的 Azure CLI 版本。

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

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

  • script: az extension add -n azure-devops displayName: 'Install Azure DevOps Extension'脚本:az extension add -n azure-devops displayName:'安装 Azure DevOps Extension'

  • task: AzureCLI@2 inputs: azureSubscription: 'AzureServiceConnection' scriptType: bash scriptLocation: 'inlineScript' inlineScript: |任务:AzureCLI@2 输入:azureSubscription:'AzureServiceConnection' scriptType:bash scriptLocation:'inlineScript' inlineScript:| az account show az 帐户显示

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

相关问题 如何在 Devops 发布管道中的 Azure CLI 脚本中使用变量 - How to use variable in Azure CLI script within Devops release Pipeline 如何从Azure ADF管道运行Azure CLI命令? - How to run Azure CLI command from azure ADF pipeline? Azure 管道 - 如何执行 kubectl 命令 - Azure pipeline - How to execute kubectl command 如何在 Azure Devops Release 管道中执行下一阶段? - How to execute next stage in Azure Devops Release pipeline? 如何将 Json 变量传递给 Azure DevOps 管道中的命令行任务? - How to pass Json variable to command line task in Azure DevOps pipeline? Azure Devops 管道任务 (Azure CLI@2) 失败 - Azure Devops Pipeline task (Azure CLI@2) failing 如何在自托管 Windows 代理上从 Azure DevOps 管道运行 Azure CLI 任务? - How to run Azure CLI tasks from an Azure DevOps Pipeline on a Self-Hosted Windows Agent? 在 Azure Devops 中,如何在运行 shell 脚本的“Azure CLI task v.2”中使用管道变量? - In Azure Devops, how can i use pipeline variables in a “Azure CLI task v.2” running shell script? 在Azure DevOps中运行az cli命令 - Running az cli command in Azure DevOps Azure DevOps 管道中的命令行脚本出错 - Error with Command Line Script in Azure DevOps Pipeline
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM