Learn / Lesson

How to read any Azure CLI command

Azure has thousands of commands. You do not memorize them. You learn the one sentence they all follow, then you read them like English.

The pattern

Every command is the same sentence: az, then what you are working on, then the action, then the details. Pick a tab below and read each one out loud.

cloud shell
aztool
role assignmentwhat you manage
createaction
--roleasks: which role?
Readeryour answer
--assigneeasks: for whom?
priya@contoso.comyour answer

Say it: “Azure, in role assignments: create one that gives Priya the Reader role.”

{ "principalName": "priya@contoso.com", "roleDefinitionName": "Reader" }

Details come in pairs

A detail is a question and your answer. --name asks “which one?” and vm-web01 answers it. Most questions also have a short form:

az vm show --resource-group rg-app --name vm-web01
az vm show -g rg-app -n vm-web01        # same command, short flags

Stuck? Ask the command

Add --help to any part of a command and Azure lists what can come next.

az network --help             # what lives under network
az network vnet --help        # what you can do with a VNet
az network vnet create --help # every question create can ask

Make the answer readable

By default Azure answers in JSON. Two flags turn that into something you can scan.

az vm list --output table                   # a table instead of JSON
az vm list --query "[].name" --output tsv   # only the VM names

When a command creates something, look for "provisioningState": "Succeeded" in the answer. That line means Azure built it.

PowerShell says the same thing

Azure PowerShell flips the order to action first: a verb, then Az and the thing. The questions start with one dash instead of two.

az group create --name rg-lab --location canadacentral            # Azure CLI
New-AzResourceGroup -Name rg-lab -Location canadacentral          # PowerShell

az vm list                                                        # Azure CLI
Get-AzVM                                                          # PowerShell

Try it

Open Azure Cloud Shell and read these before you run them. None of them changes anything.

az account show --output table
az group list --output table
az vm list-sizes --location canadacentral --output table

Want the full version?

This lesson is a short version of Chapter 2 of the AZ-104 Field Guide. That chapter is in the free sample, along with the first workplace lab.

Get the free sample