Partager via


AzureCLI@1 - Azure CLI v1 task

Run a shell or batch script with Azure CLI commands against an Azure subscription.

Inputs

azureSubscription - Azure subscription
Input alias: connectedServiceNameARM. string. Required.

Selects an Azure Resource Manager subscription for the deployment.


scriptLocation - Script Location
string. Required. Allowed values: inlineScript (Inline script), scriptPath (Script path). Default value: scriptPath.

Selects the script location.


scriptPath - Script Path
string. Required when scriptLocation = scriptPath.

Fully qualified path of the script or a path relative to the the default working directory.


inlineScript - Inline Script
string. Required when scriptLocation = inlineScript.

You can write your scripts inline here. When using Windows agent, use batch scripting. Use shell scripting when using Linux-based agents. For batch files, use the prefix call before every Azure command. You can also pass predefined and custom variables to this script using arguments

See the following examples. The first is a shell example and the second is a batch example:

azure --version || azure account show 
call  azure --version || call azure account show

arguments - Arguments
Input alias: args. string.

Arguments passed to the script.


workingDirectory - Working Directory
Input alias: cwd. string.

Current working directory where the script is run. If left blank, this input is the root of the repo (build) or artifacts (release), which is $(System.DefaultWorkingDirectory).


failOnStandardError - Fail on Standard Error
boolean. Default value: true.

If this input is true, this task will fail when any errors are written to the StandardError stream. Clear the checkbox to ignore standard errors and instead rely on exit codes to determine the status.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

What's new in Version 1.0:

  • Supports the new Azure CLI 2.0 which is Python based
  • Works with cross-platform agents (Linux, macOS, or Windows)
  • For working with Azure CLI 1.0 (node.js-based), switch to task version 0.0
  • Limitations: - No support for Azure Classic subscriptions. Azure CLI 2.0 supports only Azure Resource Manager (ARM) subscriptions.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.0.0 or greater
Task category Deploy