Skip to content

Azure CLI cheatsheet

# Login (global cloud)
az login

# Login to Azure China (separate cloud!)
az cloud set --name AzureChinaCloud
az login

# List / set subscription
az account list -o table
az account set --subscription "<name-or-id>"

# Resource groups
az group list -o table
az group create -n rg-emea-prod -l westeurope

# Query resources with JMESPath
az resource list --query "[?location=='westeurope'].{name:name,type:type}" -o table

# Who am I / current context
az account show -o table

China is a separate cloud

Always confirm az cloud show before running anything against China resources.