Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure CLI is a cross-platform tool that simplifies managing Azure resources from the command line. Optimized for automation and ease of use, it supports interactive sessions and scripting with straightforward commands that integrate seamlessly with the Azure Resource Manager model. You can start using it in your browser with Azure Cloud Shell or install it locally to use from your preferred terminal.
Install or run in Azure Cloud Shell
The easiest way to try Azure CLI is through Azure Cloud Shell, a browser-based shell with no installation required. Cloud Shell supports Bash and PowerShell and comes with the latest version of Azure CLI preinstalled.
To install Azure CLI locally, see How to install Azure CLI.
To check your version, run:
az version
Sign in to Azure
To start using Azure CLI with a local install, sign in:
Run the
az logincommand.az loginIf Azure CLI can open your default browser, it initiates authorization code flow and opens the default browser to load an Azure sign-in page.
Otherwise, it initiates the device code flow and instructs you to open a browser page at https://aka.ms/devicelogin. Then, enter the code displayed in your terminal.
If no web browser is available or the web browser fails to open, you can force device code flow with
az login --use-device-code.Sign in with your account credentials in the browser.
Important
Starting in September 2025, Microsoft will require multifactor authentication (MFA) for Azure CLI and other command-line tools. This change applies only to Microsoft Entra ID user identities and doesn't affect workload identities such as service principals or managed identities.
If you're using az login with a username and password to authenticate scripts or automated
workflows, now is the time to migrate to a workload identity.
After you sign in, a list of your subscriptions appears. The one marked isDefault: true is
currently active. To change to a different subscription, run:
az account set --subscription "<subscription-id>"
Find commands
Azure CLI commands are organized as command groups. Each group represents an area of an Azure service. There are two options to find command groups:
Use the az find command. For example, to search for command names containing
vm, use the following example:az find vmUse the
--helpargument to get a complete list of subgroups within a reference group. The following example returns all subgroups for virtual machines:az vm --helpThe following example shows the relevant portion of the output.
Subgroups: application : Manage applications for VM. availability-set : Group resources into availability sets. boot-diagnostics : Troubleshoot the startup of an Azure Virtual Machine. ...The help output includes subgroups, parameters, authentication options, and examples.
Here's another example that finds the Azure CLI commands for grouping virtual machines into availability sets, a subgroup of
az vm:az vm availability-set --helpYou can also use
--helpto get parameter lists and command examples for a reference command.az vm create --helpHere is the relevant section of the example output:
Arguments --name [Required] : Name of the virtual machine. ... Authentication Arguments --admin-password : Password for the VM if authentication type is 'Password'. --admin-username : Username for the VM... ... Managed Service Identity Arguments ... Examples Create a VM from a custom managed image. az vm create -g MyResourceGroup -n MyVm --image MyImage ...Use the reference index that lists all command groups alphabetically.
Use tab completion
Azure CLI supports tab completion in Bash. To enable it in PowerShell, see Enable tab completion in PowerShell.
Understand global arguments
Common arguments available to most commands include:
| Argument | Description |
|---|---|
--help |
View command help |
--output |
Change output format: json, jsonc, tsv, table, yaml |
--query |
Filter output using JMESPath |
--verbose |
Print more execution details |
--debug |
Show low-level REST calls for debugging |
--subscription |
Specify subscription name or ID |
--only-show-errors |
Suppress noncritical output |
Use interactive mode
Run interactive mode with:
az interactive
Interactive mode launches an enhanced Azure CLI experience with inline help and command suggestions. For more, see Interactive Mode.
An optional VS Code extension provides similar features with autocomplete and hover tips.
Provide feedback
We welcome your feedback. Submit issues on GitHub or run:
az feedback