If no web browser is available or the web browser fails to open, you may force device code flow with az login --use-device-code.
Sign in with your account credentials in the browser.
After logging in, you receive a list of subscriptions associated with your Azure account. The
subscription information with isDefault: true is the currently activated subscription after
logging in. To select another subscription, use the az account set
command with the subscription ID of the desired account. For more information about subscription selection,
see Manage Azure subscriptions.
There are ways to sign in non-interactively, which are covered in detail in Sign in with Azure CLI.
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 command:
az find vm
Use the --help argument to get a complete list of subgroups within a reference group. This example returns all the subgroups for virtual machines:
az vm --help
Here is example output with lines omitted for brevity:
Subgroups:
application : Manage applications for VM.
availability-set : Group resources into availability sets.
boot-diagnostics : Troubleshoot the startup of an Azure Virtual Machine.
...
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 --help
Also use --help to get parameter lists and command examples for a reference command.
az vm create --help
Here is example output with lines omitted for brevity:
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
...
Article index A to Z. Use your keyboard find shortcut keys, like
Ctrl + F, to drop quickly to the reference command group in which you're interested. For example, the article index looks something like this for az vm:
The CLI has full tab completion for commands in a Bash environment. To enable tab completion in a PowerShell environment, see Enable tab completion in PowerShell.
Be aware of globally available arguments
There are some arguments that are available for most commands.
--help prints CLI reference information about commands and their arguments and lists available subgroups and
commands.
--output changes the output format. The available output formats are json, jsonc (colorized JSON), tsv (Tab-Separated
Values), table (human-readable ASCII tables), and yaml. By default the CLI outputs json. To learn more about the available
output formats, see Output formats for Azure CLI.
--verbose prints information about resources created in Azure during an operation, and other useful information.
--debug prints even more information about CLI operations, used for debugging purposes. If you find a bug, provide output generated with the --debug flag on when submitting a bug report. It can be used, for example, to identify the REST API that the command executed is invoking underneath, and the response received from the service.
--only-show-errors suppresses warnings in command output and only shows errors.
Use interactive mode
The CLI offers an interactive mode that automatically displays help information and makes it easier to
select subcommands. You enter interactive mode with the az interactive command.
In scripts and on the Microsoft documentation site, Azure CLI examples are written for the
Bash shell. Most one-line examples will run on any platform. Longer examples which include line
continuations (\), variable assignment, or quotes need to be modified to work in other shells,
including PowerShell. For more information on syntax differences between environments,
see Learn syntax differences between Bash, PowerShell, and Cmd.
Give feedback
We welcome your feedback for the CLI to help us make improvements and resolve bugs. You can file an issue on GitHub or use the built-in
features of the CLI to leave general feedback with the az feedback command.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Azure CLI feedback
Azure CLI is an open source project. Select a link to provide feedback:
Learn the different authentication types for your Azure CLI login — sign in with Azure CLI automatically, locally, or interactively using the az login command.
Learn how to use Bash with Azure CLI. Query, format output, filter, use variables, and use Bash constructs of loops, if/exists/then and case statements.