Azure CLI 2 cheatsheet

Azure CLI 2: Sign-in and setup

8 common Azure CLI 2 tasks.

Check the CLI version

Print the Azure CLI version and installed extensions.

az version

Sign in

Sign in through the browser.

az login

Sign in without a browser

Sign in on a machine with no browser by entering a code on another device.

az login --use-device-code

Show the current subscription

Show which account and subscription commands will use.

az account show

List subscriptions

List all subscriptions you can use, as a table.

az account list --output table

Switch subscription

Choose the subscription later commands run against.

az account set --subscription "My Subscription"

Set defaults

Set a default resource group and location so you don't repeat them.

az configure --defaults group=my-rg location=westeurope

Search for commands

Find commands and examples by describing what you want.

az find "az vm create"

Was this page helpful?