Get started with Azure CLI 2.0
Welcome to the Azure CLI 2.0! The CLI is a tool designed to get you working quickly and efficiently with Azure services, with an emphasis on automation. This article introduces features of the CLI and links out to resources that help you be productive.
Install and log in
Before using any CLI commands with a local install, you need to log in with az login.
This command prompts you to log in with an authentication code via a website. There are ways to log in non-interactively, which are covered in detail in Log in with Azure CLI 2.0.
This table lists a few of the common commands used in the CLI links out to their documentation pages in the reference.
All subcommands of these groups and their documentation can be looked up in online reference or with the
|Resource type||Azure CLI command group|
|Resource group||az group|
|Virtual machines||az vm|
|Storage accounts||az storage account|
|Key Vault||az keyvault|
|Web applications||az webapp|
|SQL databases||az sql server|
Commands in the CLI are provided as subcommands of groups. Each group represents a service provided by Azure, and the subgroups divide commands for these services into logical groupings.
To search for commands, use az find. For example, to search for command names containing
use the following command:
az find -q secret
If you know which group of commands you want to work with, the
may be a better choice. This displays not just detailed information for a command, but when used with a command group, displays all of the available subcommands. For example, when working with Network Security Groups (NSGs) you can find the available
NSG subgroups and commands.
az network nsg --help
The CLI has full tab completion for commands under the bash shell.
Globally available arguments
There are some arguments that are available for every command.
--helpprints CLI reference information about commands and their arguments and lists available subgroups and commands.
--outputchanges the output format. The available output formats are
tsv(Tab-Separated Values), and
table(human-readable ASCII tables). By default the CLI outputs
json. To learn more about the available output formats, see Output formats for Azure CLI 2.0.
--queryuses the JMESPath query language to filter the output returned from Azure services. To learn To learn more about queries, see Query command results with Azure CLI 2.0 and the JMESPath tutorial.
--verboseprints information about resources created in Azure during an operation, and other useful information.
--debugprints even more information about CLI operations, used for debugging purposes. If you encounter a bug, provide output generated with the
--debugflag on when submitting a bug report.
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. For more information on interactive mode and how it helps you learn the CLI, see Azure CLI 2.0 Interactive Mode.
There is also a Visual Studio Code plugin that offers an interactive experience, including autocomplete and mouse-over documentation.
Learn CLI basics with quickstarts and tutorials
To get you started with the Azure CLI 2.0, try an in-depth tutorial for setting up virtual machines and using the power of the CLI to query Azure resources.
If you would rather focus on other services, there are a variety of quickstarts for Azure services that use the CLI.
- Create a storage account using the Azure CLI
- Transfer objects to/from Azure Blob storage using the CLI
- Create a single Azure SQL database using the Azure CLI
- Create an Azure Database for MySQL server using the Azure CLI
- Create an Azure Database for PostgreSQL using the Azure CLI
- Create a Python web app in Azure
- Run a custom Docker Hub image in Azure Web Apps for Containers
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.