azure cli

Azure CLI 2.60+

Quick reference for the Azure CLI (az): authentication, subscription / resource management, VM / AKS / Storage / App Service / Key Vault, query formatting, and CI-friendly workflows — with common options and practical examples.

43 commands

Help

az --version

Print the Azure CLI version + the Python interpreter it uses.

az --version
az find <query>

Search for `az` commands by keyword — uses a static search index shipped with the CLI.

az find 'aks'
az <group> --help

Show every command under a group.

<group> --help; <group> <command> --help

az storage --help
az <group> <command> --help

Show flags + examples for a single command.

az vm create --help
az interactive

Drop into an interactive shell with auto-completion, syntax highlighting, and inline docs.

--style; --update; --no-param-expansion

az interactive

Authentication

az login

Launch a browser-based login (uses device code flow when no display is available).

--use-device-code; --tenant <tenant>; --service-principal -u <id> -p <secret> --tenant <tenant>; --federated-token <token>; --identity

az login
az login --use-device-code

Use the device-code flow — prints a URL + code to paste in a browser on any device.

az login --use-device-code --tenant contoso.onmicrosoft.com
az login --service-principal -u <appId> -p <password> --tenant <tenant>

Login as a service principal with a client secret (CI / automation).

-u <id>; -p <secret>; --tenant <tenant>; --federated-token <jwt>

az login --service-principal -u $APP_ID -p $APP_SECRET --tenant $TENANT
az logout

Clear all credentials and end the current session.

--username <upn>

az logout
az account show

Print the currently active subscription, tenant, and user.

--output table; --query

az account show --output table
az account list

List every subscription your account has access to.

--output table; --query '[].{name:name,id:id}'; --all

az account list --output table
az account set --subscription <id>

Switch the active subscription for subsequent commands.

--subscription <id>; --name <name>

az account set --subscription 'My Dev Subscription'
az account clear

Clear all subscriptions from the local cache (forces a re-login).

az account clear && az login

Output

az <cmd> --output <format>

Choose output format: `json` (default), `table`, `tsv`, `yaml`, `yamlc`, `none`.

json; table; tsv; yaml; yamlc; none

az vm list --output table
az <cmd> --query '<JMES>'

Project the response with a JMESPath expression.

--query '[].name'; --query 'length(@)'; --query 'sort_by(@, &name)'

az vm list --query '[].{name:name,rg:resourceGroup,size:hardwareProfile.vmSize}' --output table
az <cmd> --no-wait

Return immediately without waiting for the long-running operation to complete (poll later with `az <verb> wait`).

az vm create --no-wait --resource-group rg --name myvm --image image

Resource group

az group list

List every resource group in the active subscription.

--output table; --query '[].name'

az group list --output table
az group create --name <rg> --location <loc>

Create a new resource group.

--name; --location eastus; --tags env=prod

az group create --name rg-prod --location eastus --tags env=prod
az group delete --name <rg>

Delete a resource group + every resource it contains (irreversible).

--name; --yes; --no-wait

az group delete --name rg-old --yes --no-wait

Resource

az resource list

List every Azure resource under the current subscription.

--resource-group <rg>; --resource-type <type>; --name <name>; --tag env=prod

az resource list --output table
az tag

Manage resource tags at scale (resource-group level).

create; update; list; delete

az tag create --resource-group rg-prod --tags env=prod owner=alice

VM

az vm list

List every VM with its size + status.

--resource-group; --show-details; --query

az vm list --output table
az vm start --name <name> --resource-group <rg>

Start a VM (deallocates compute if it was previously stopped).

--no-wait

az vm start -n vm-dev -g rg-dev --no-wait
az vm stop --name <name> --resource-group <rg>

Stop (deallocate) a VM to stop compute billing.

--no-wait

az vm deallocate -n vm-dev -g rg-dev --no-wait
az ssh vm --name <name> --resource-group <rg>

Use the new native SSH support (Azure CLI 2.30+) to open a session without an explicit public IP.

-n; -g; --ssh-key-file <path>; --port <p>

az ssh vm --name vm-dev --resource-group rg-dev

AKS

az aks list

List every AKS cluster.

--resource-group; --output table

az aks list --output table
az aks get-credentials --name <name> --resource-group <rg> --overwrite-existing

Merge the cluster's kubeconfig into `~/.kube/config` and switch context.

--name; --resource-group; --admin; --overwrite-existing; --file <kubeconfig>

az aks get-credentials --name my-cluster --resource-group rg-prod --overwrite-existing
az aks create --name <name> --resource-group <rg>

Create an AKS cluster. Most common flags: `--node-count`, `--node-vm-size`, `--kubernetes-version`, `--generate-ssh-keys`.

--name; -g; --node-count; --node-vm-size; --kubernetes-version; --generate-ssh-keys; --service-principal; --no-ssh-key

az aks create -g rg-prod -n my-cluster --node-count 3 --generate-ssh-keys

Storage

az storage account list

List every storage account.

--output table; --query '[].name'

az storage account list --output table
az storage blob upload --account-name <acc> --container-name <c> --name <blob> --file <path>

Upload a file as a blob. Use `--account-key`, SAS token, or auth-mode login.

--account-name; --container-name; --name; --file <local>; --auth-mode login; --sas-token; --overwrite

az storage blob upload --account-name mysa --container-name uploads --name backup.zip --file backup.zip --auth-mode login
az storage blob download --account-name <acc> --container-name <c> --name <blob> --file <path>

Download a blob to a local path.

--account-name; --container-name; --name; --file <local>; --auth-mode login

az storage blob download --account-name mysa --container-name uploads --name backup.zip --file ./backup.zip

App Service

az webapp list

List every App Service webapp.

--resource-group; --output table

az webapp list --output table
az webapp deploy --name <name> --resource-group <rg> --src-path <local-zip>

Deploy a built artifact to a webapp (zip deploy).

--src-path <zip>; --type zip; --target-path; --async

az webapp deploy -g rg-prod -n web-prod --src-path ./app.zip
az webapp log tail --name <name> --resource-group <rg>

Stream container log output to the terminal.

--name; -g; --provider

az webapp log tail -n web-prod -g rg-prod

Key Vault

az keyvault list

List every Key Vault in the subscription.

--output table; --resource-type vault

az keyvault list --output table
az keyvault secret set --vault-name <kv> --name <name> --value <value>

Add or update a secret. Use `--file <path>` to load from a file.

--vault-name; --name; --value; --file; --encoding utf-8

az keyvault secret set --vault-name my-kv --name DB-PASSWORD --value $DB_PASSWORD
az keyvault secret show --vault-name <kv> --name <name>

Read a secret's metadata + value.

az keyvault secret show --vault-name my-kv --name DB-PASSWORD --query 'value' -o tsv

Container Registry

az acr list

List every Container Registry.

--resource-group; --output table

az acr list --output table
az acr login --name <name>

Login Docker to an ACR — `docker push/pulling` works directly after.

az acr login --name myregistry

Diagnose

az configure

Manage CLI defaults (output format, default location, default group, ...).

--defaults; --list-defaults

az configure --defaults location=eastus group=rg-prod
az upgrade

Upgrade the Azure CLI to the latest release (Linux only — on Windows use the installer).

az upgrade
az extension list

List installed CLI extensions (az aks-preview, az spring, ...).

list; show; add; remove; update

az extension add --name aks-preview
az --debug <cmd>

Print HTTP request / response debug info to stderr.

--debug; --only-show-errors

az --debug vm list 2> az.log

Related command cheatsheets

About Azure CLI

The Azure CLI (`az`) is Microsoft's official command-line tool for managing Azure resources. Released in 2014 and built on Python, `az` is cross-platform (Windows, macOS, Linux), ships as a single MSI / pkg / apt / brew install, and is now the default CLI for every Azure scenario that previously needed PowerShell `Az` modules. The current stable line is Azure CLI 2.60+ (Python 3.11+ runtime). `az` follows the verb-noun convention: `az <verb> <noun>` (e.g. `az storage blob upload`, `az aks get-credentials`, `az vm list`). Commands support JMESPath queries (`--query`), tabular / json / yaml / tsv output (`--output`), and resource-level auto-prompt for parameter completion. Authentication supports interactive `az login`, service principals, managed identities, and OIDC / federated credentials (CI without secrets). Azure CLI is MIT-licensed and never uploads source code outside of explicit API calls.

Cheatsheet version 1.0.0