Azure CLI Cheat Sheet
Durchsuchbare Azure-CLI-Befehlsreferenz: Login, Ressourcengruppen, VMs, Storage, Web Apps und AKS, mit jedem Parameter erklärt.
Läuft im Browser · es wird nichts gesendetNeu
31 Befehle
Login & subscriptions
az loginSign in to Azure interactively, opening a browser window for authentication.
az loginSign in to Azure interactively, opening a browser window for authentication.On a machine without a browser (a server or container), use "az login --use-device-code" instead: it prints a short code to enter on a second device.
Optionen
--use-device-code | Sign in using a code entered on another device, for machines without a browser. |
|---|---|
--tenant <id> | Sign in to a specific Microsoft Entra tenant instead of the default one. |
--service-principal -u <id> -p <secret-or-cert> --tenant <id> | Sign in as a service principal, for scripts and CI/CD instead of a human. |
az account listList every subscription the signed-in account has access to, and show which one is currently active.
az account listList every subscription the signed-in account has access to, and show which one is currently active.Beispiel
az account list --output table
az account set --subscription <name-or-id>Switch the active subscription that subsequent commands operate on.
az account set --subscription <name-or-id>Switch the active subscription that subsequent commands operate on.Needed whenever a sign-in has access to more than one subscription and the default one is not the right target.
az account showShow the currently active subscription, tenant ID and signed-in account.
az account showShow the currently active subscription, tenant ID and signed-in account.The quickest way to confirm which subscription a command would run against before doing something that matters.
az configure --defaults group=<name> location=<region>Set default values (resource group, location, and more) so later commands can omit those flags.
az configure --defaults group=<name> location=<region>Set default values (resource group, location, and more) so later commands can omit those flags.Beispiel
az configure --defaults group=my-rg location=westeurope
az <command> --output <format>Set the output format for a single command.
az <command> --output <format>Set the output format for a single command.Optionen
json | The default. Full structured output. |
|---|---|
jsonc | Colorized JSON, for an interactive terminal. |
table | A human-readable ASCII table, using a fixed set of columns per command. |
tsv | Tab-separated values, convenient for shell scripting. |
yaml | YAML output. |
none | Suppress output entirely. |
az <command> --query "<JMESPath>"Filter and reshape the JSON response using a JMESPath expression before it is formatted for output.
az <command> --query "<JMESPath>"Filter and reshape the JSON response using a JMESPath expression before it is formatted for output.Beispiel
az vm list --query "[].{Name:name, Size:hardwareProfile.vmSize}" --output tableResource groups
az group create --name <name> --location <region>Create a new resource group, the container that holds related resources in one region and lifecycle.
az group create --name <name> --location <region>Create a new resource group, the container that holds related resources in one region and lifecycle.Beispiel
az group create --name my-rg --location westeurope
Optionen
--name -n <name> | Name of the resource group. |
|---|---|
--location -l <region> | Azure region, for example westeurope, eastus. See "az account list-locations" for the full list. |
--tags <key=value> [...] | Tags to apply to the resource group. |
az group list --output tableList every resource group in the active subscription.
az group list --output tableList every resource group in the active subscription.Does not show resources inside each group; use "az resource list --resource-group <name>" for that.
az group delete --name <name>Delete a resource group and every resource inside it.
az group delete --name <name>Delete a resource group and every resource inside it.Optionen
--yes -y | Skip the interactive confirmation prompt. |
|---|---|
--no-wait | Return immediately instead of waiting for the deletion to finish. |
az resource list --resource-group <name>List every resource inside a resource group, across all resource types.
az resource list --resource-group <name>List every resource inside a resource group, across all resource types.Omit --resource-group to list every resource in the whole subscription instead.
Virtual machines
az vm create --resource-group <name> --name <vm-name> --image <image>Create a virtual machine, and by default also a virtual network, public IP, network security group and NIC if none are specified.
az vm create --resource-group <name> --name <vm-name> --image <image>Create a virtual machine, and by default also a virtual network, public IP, network security group and NIC if none are specified.Beispiel
az vm create --resource-group my-rg --name my-vm --image Ubuntu2404 --size Standard_B2s --admin-username azureuser --generate-ssh-keys
Optionen
--resource-group -g <name> | Resource group to create the VM in. Required. |
|---|---|
--name -n <name> | Name of the virtual machine. Required. |
--image <urn-or-alias> | OS image, as an alias (for example Ubuntu2404), a full URN "Publisher:Offer:Sku:Version", or the ID of a custom/shared image. Required unless --attach-os-disk is used. |
--size <vm-size> | VM size (SKU), for example Standard_B2s, Standard_D2s_v5. Defaults to Standard_DS1_v2 if omitted. |
--admin-username <name> | Username for the VM. Defaults to the current OS username, falling back to azureuser if that name is reserved. |
--admin-password <password> | Password for the VM, when --authentication-type is password. Must meet Azure's complexity requirements. |
--authentication-type <all|password|ssh> | Defaults to ssh for Linux and password for Windows. |
--generate-ssh-keys | Generate a new SSH key pair if none exists yet in ~/.ssh, and use it for the VM. Reuses an existing key pair if one is already there. |
--vnet-name / --subnet <name> | Existing virtual network and subnet to place the VM in. Creates new ones with default settings if omitted. |
--nsg <name> | Network security group to create (default) or attach by name/ID. Use --nsg "" for none. |
--nsg-rule <RDP|SSH|NONE> | Inbound rule to open on a newly created NSG. Defaults to SSH on Linux, RDP on Windows. |
--public-ip-sku <Basic|Standard> | SKU of the public IP created for the VM. Standard is required for availability zones. |
--data-disk-sizes-gb <size> [...] | Create one or more empty managed data disks of the given sizes in GB. |
--no-wait | Return immediately instead of waiting for the VM to finish provisioning. |
az vm list --output tableList VMs in the active subscription (or a resource group, with --resource-group), without their live power state.
az vm list --output tableList VMs in the active subscription (or a resource group, with --resource-group), without their live power state.For the current running/stopped state of each VM, use "az vm list --show-details" (slower, since it queries each VM individually) or "az vm get-instance-view".
az vm list-ip-addresses --resource-group <name> --output tableShow the private and public IP addresses of VMs in a resource group.
az vm list-ip-addresses --resource-group <name> --output tableShow the private and public IP addresses of VMs in a resource group.Faster than reading IPs out of the full "az vm show" output when all you need is the addresses.
az vm start --resource-group <name> --name <vm-name>Start a stopped VM. Use "az vm stop" to shut it down (still billed for allocated compute), or "az vm deallocate" to also release the compute allocation and stop that billing.
az vm start --resource-group <name> --name <vm-name>Start a stopped VM. Use "az vm stop" to shut it down (still billed for allocated compute), or "az vm deallocate" to also release the compute allocation and stop that billing.A VM stopped with "az vm stop" keeps its reserved hardware and is still billed. "az vm deallocate" releases the hardware, stops compute billing, but can change the public IP unless it is a Standard SKU static IP.
az vm delete --resource-group <name> --name <vm-name>Delete a VM. By default this does not delete its disks, NIC or public IP; those become orphaned resources still being billed.
az vm delete --resource-group <name> --name <vm-name>Delete a VM. By default this does not delete its disks, NIC or public IP; those become orphaned resources still being billed.Optionen
--yes -y | Skip the confirmation prompt. |
|---|---|
--force-deletion | Skip the graceful shutdown and force-delete the VM. |
az vm run-command invoke --resource-group <name> --name <vm-name> --command-id RunShellScript --scripts "<script>"Run a shell (Linux) or PowerShell (Windows, with --command-id RunPowerShellScript) script inside a VM without needing SSH or RDP access.
az vm run-command invoke --resource-group <name> --name <vm-name> --command-id RunShellScript --scripts "<script>"Run a shell (Linux) or PowerShell (Windows, with --command-id RunPowerShellScript) script inside a VM without needing SSH or RDP access.Runs through the Azure VM agent, so it works even when network security group rules block direct SSH/RDP from your location.
Storage
az storage account create --name <name> --resource-group <name> --sku <sku>Create a storage account, the parent resource for blob containers, file shares, queues and tables.
az storage account create --name <name> --resource-group <name> --sku <sku>Create a storage account, the parent resource for blob containers, file shares, queues and tables.Optionen
--sku <sku> | Replication and performance tier, for example Standard_LRS, Standard_GRS, Premium_LRS. |
|---|---|
--kind <kind> | Account kind, for example StorageV2 (default, recommended) or BlockBlobStorage. |
--allow-blob-public-access <false|true> | Whether anonymous public read access to blobs can be enabled at all. Defaults to false on new accounts. |
az storage container create --name <name> --account-name <account> --auth-mode loginCreate a blob container inside a storage account.
az storage container create --name <name> --account-name <account> --auth-mode loginCreate a blob container inside a storage account.Optionen
--auth-mode <key|login> | How to authorize the data operation: "key" uses the storage account key, "login" uses your signed-in Microsoft Entra identity (recommended, needs an RBAC role like Storage Blob Data Contributor). |
|---|---|
--public-access <off|blob|container> | Anonymous access level for the container. Defaults to off. |
az storage blob upload --account-name <account> --container-name <container> --name <blob-name> --file <local-path> --auth-mode loginUpload a single local file as a blob.
az storage blob upload --account-name <account> --container-name <container> --name <blob-name> --file <local-path> --auth-mode loginUpload a single local file as a blob.Beispiel
az storage blob upload --account-name mystorage --container-name site --name index.html --file ./dist/index.html --auth-mode login --overwrite
Optionen
--file <path> | Local file to upload. |
|---|---|
--name -n <blob-name> | Name the blob will have in the container. |
--overwrite | Replace the blob if one with the same name already exists. Without it, the upload fails if the blob exists. |
--auth-mode <key|login> | Same as on container create. |
az storage blob upload-batch --destination <container> --account-name <account> --source <local-dir> --auth-mode loginUpload every file in a local directory (optionally recursive) to a container in one command.
az storage blob upload-batch --destination <container> --account-name <account> --source <local-dir> --auth-mode loginUpload every file in a local directory (optionally recursive) to a container in one command.Optionen
--destination <container> | Target container name. |
|---|---|
--source <path> | Local directory to upload from. |
--pattern "<glob>" | Only upload files matching this glob pattern. |
--overwrite | Replace blobs that already exist with the same name. |
az storage blob list --account-name <account> --container-name <container> --auth-mode login --output tableList the blobs in a container.
az storage blob list --account-name <account> --container-name <container> --auth-mode login --output tableList the blobs in a container.Optionen
--prefix <value> | Only list blobs whose name starts with this prefix. |
|---|
Web apps
az appservice plan create --name <name> --resource-group <name> --sku <sku>Create an App Service plan, the compute tier (and billing unit) that one or more web apps run on.
az appservice plan create --name <name> --resource-group <name> --sku <sku>Create an App Service plan, the compute tier (and billing unit) that one or more web apps run on.Optionen
--sku <sku> | Pricing tier, for example F1 (free), B1 (basic), P1V3 (premium). |
|---|---|
--is-linux | Create a Linux plan instead of the default Windows plan. Required for most container and Node/Python/PHP runtimes. |
az webapp create --name <name> --resource-group <name> --plan <plan> --runtime <runtime>Create a web app on an existing App Service plan.
az webapp create --name <name> --resource-group <name> --plan <plan> --runtime <runtime>Create a web app on an existing App Service plan.Beispiel
az webapp create --name my-app --resource-group my-rg --plan my-plan --runtime "NODE:20-lts"
Optionen
--runtime <stack:version> | Managed runtime stack, for example "NODE:20-lts", "PYTHON:3.12". Run "az webapp list-runtimes" to see current options. |
|---|---|
--deployment-container-image-name <image> | Use a container image instead of a managed runtime. |
az webapp up --name <name> --resource-group <name> --runtime <runtime>A convenience command that creates the resource group, plan and web app (whichever do not already exist) and deploys the current folder in one step.
az webapp up --name <name> --resource-group <name> --runtime <runtime>A convenience command that creates the resource group, plan and web app (whichever do not already exist) and deploys the current folder in one step.Good for quickly getting a project online; for repeatable deployments, prefer separate create/deploy steps or infrastructure as code.
az webapp deploy --resource-group <name> --name <app-name> --src-path <file>Deploy a zip, war, jar or static file to an existing web app.
az webapp deploy --resource-group <name> --name <app-name> --src-path <file>Deploy a zip, war, jar or static file to an existing web app.Optionen
--src-path <path> | Local package to deploy. |
|---|---|
--type <zip|war|jar|static|startup> | What kind of artifact is being deployed. Inferred from the file extension if omitted. |
az webapp log tail --resource-group <name> --name <app-name>Stream live application and web server logs from a running web app to the terminal.
az webapp log tail --resource-group <name> --name <app-name>Stream live application and web server logs from a running web app to the terminal.Requires log streaming to be enabled first with "az webapp log config --application-logging filesystem".
AKS (Kubernetes)
az aks create --resource-group <name> --name <cluster-name> --node-count <n> --generate-ssh-keysCreate a managed Kubernetes cluster.
az aks create --resource-group <name> --name <cluster-name> --node-count <n> --generate-ssh-keysCreate a managed Kubernetes cluster.Beispiel
az aks create --resource-group my-rg --name my-cluster --node-count 2 --node-vm-size Standard_B2s --generate-ssh-keys
Optionen
--node-count <n> | Number of nodes in the default node pool. |
|---|---|
--node-vm-size <size> | VM size for the nodes in the default node pool. |
--generate-ssh-keys | Generate a new SSH key pair if none exists, needed for node access and required by the command if no key is configured. |
--enable-cluster-autoscaler --min-count <n> --max-count <n> | Automatically scale the node pool between these bounds based on load. |
--network-plugin <azure|kubenet|none> | CNI used for pod networking. azure gives pods IPs from the VNet; kubenet is simpler but has more limitations at scale. |
--attach-acr <registry-name> | Grant the cluster pull access to an existing Azure Container Registry. |
az aks get-credentials --resource-group <name> --name <cluster-name>Download the cluster's kubeconfig and merge it into your local kubectl config, so kubectl can target this cluster.
az aks get-credentials --resource-group <name> --name <cluster-name>Download the cluster's kubeconfig and merge it into your local kubectl config, so kubectl can target this cluster.Optionen
--admin | Get cluster administrator credentials instead of the regular user credentials (bypasses Entra ID authentication, if enabled). |
|---|---|
--overwrite-existing | Overwrite an existing context of the same name instead of failing. |
az aks scale --resource-group <name> --name <cluster-name> --node-count <n>Change the number of nodes in the default node pool.
az aks scale --resource-group <name> --name <cluster-name> --node-count <n>Change the number of nodes in the default node pool.For additional node pools beyond the default one, use "az aks nodepool scale" with --nodepool-name instead.
az aks delete --resource-group <name> --name <cluster-name>Delete an AKS cluster and its node pools.
az aks delete --resource-group <name> --name <cluster-name>Delete an AKS cluster and its node pools.Optionen
--yes -y | Skip the confirmation prompt. |
|---|
Die Beschreibungen in dieser Referenz sind derzeit auf Englisch.
Erklärung
Suche oder filtere nach Gruppe und kopiere einen Befehl mit einem Klick. Öffne einen Befehl für eine Erklärung, ein Beispiel und jeden Parameter, den er annimmt, mit Warnungen bei allem, was eine Ressource löscht oder Netzwerkzugriff öffnet.
🔒 Deine Eingabe bleibt in deinem Browser und wird nirgendwohin gesendet.
Häufige Fragen
Warum öffnet az vm create standardmäßig SSH oder RDP ins Internet?
Sofern --nsg-rule NONE nicht gesetzt ist, erstellt Azure eine Network-Security-Group-Regel, die SSH (Linux) oder RDP (Windows) von jeder Quelladresse aus öffnet. Beschränke den Quellbereich für alles außer einem schnellen Test.
Wie geht es weiter?
Problem gefunden oder einen Vorschlag? Schreib uns