Run a shell or batch script containing Azure CLI commands against an Azure subscription.
This task is used to run Azure CLI commands on cross-platform agents running on Windows, Linux or Mac operating systems.
The task is under development. If you encounter problems, or wish to share feedback about the task and features you would like to see, please contact us.
What's new in Version 1.0
- Supports the new AZ CLI 2.0, which is Python based
- Works with Xplat agents (Windows, Linux or OSX)
- To work with Azure CLI 1.0, which is node based, switch to task version 0.0
- Both versions of Azure-CLI can coexist in the same system, but task V1.0 logs into the Python based AZ CLI using the user's subscription, whereas task V0.0 logs into the node based Azure CLI. Therefore, scripts should include only the appropriate corresponding commands.
- No support for Classic subscriptions. AZ CLI 2.0 supports only Azure Resource Manager (ARM) subscriptions
- Currently, Hosted agents do not have AZ CLI installed. You can either install using
npm install -g azure-clior use private agents with AZ CLI pre-installed
- A Microsoft Azure subscription
- A service endpoint connection to your Azure account. You can use either:
- Azure CLI installed on the computer(s) that run the build and release agent. See Install the Azure CLI. If an agent is already running on the machine on which the Azure CLI is installed, restart the agent to ensure all the relevent environment variables are updated.
|Azure Connection Type||Required. Select the type of service endpoint used to define the connection to Azure. Choose Azure Classic or Azure Resource Manager. This parameter is shown only when the selected task version is 0.* as Azure CLI task v1.0 supports only Azure Resource Manager (ARM) subscriptions.|
|Azure Classic Subscription||Required if you select Azure Classic for the Azure Connection Type parameter. The name of an Azure Classic service endpoint configured for the subscription where the target Azure service, virtual machine, or storage account is located.|
|Azure RM Subscription||Required if you select Azure Resource Manager for the Azure Connection Type parameter. The name of an Azure Resource Manager service endpoint configured for the subscription where the target Azure service, virtual machine, or storage account is located. See Azure Resource Manager overview for more details.|
|Script Location||Required. The way that the script is provided. Choose Inline Script or Script Path (the default).|
|Inline Script||Required if you select Inline Script for the Script Location parameter. Type or copy the script code to execute here. You can include default variables, global variables, and environment variables.|
|Script Path||Required if you select Script Path for the Script Location parameter. The path to a linked artifact that is the .bat, .cmd, or .sh script you want to run. It can be a fully-qualified path, or a valid path relative to the default working directory.|
|Arguments||Optional. Any arguments you want to pass to the script.|
|Advanced - Working Directory||Optional. The working directory in which the script will execute. If not specified, this will be the folder containing the script file.|
|Advanced - Fail on Standard Error||Set this option if you want the build to fail if errors are written to the StandardError stream.|
|Control options||See Control options|
Do I need an agent?
You need at least one agent to run your build or release. Get an agent.
I can't select a default agent queue and I can't queue my build or release. How do I fix this?