Skip to content
Tutorials Center
My learning

Topics

Lesson 57 of 57 ยท Practice and Review

Azure Cheat Sheet

A one-page Azure cheat sheet: az CLI commands, service-selection table, naming rules and prefixes, CIDR and SLA quick math, key limits and KQL snippets.

This page is the quick reference for the whole Azure track: the commands you type most often, a table for choosing a service, naming rules, address and availability arithmetic, and a handful of KQL snippets. It is meant for scanning, not for learning a topic from scratch. Every row links to the lesson that explains it.

Everything about Azure itself is read-only here, and limits and prices change, so treat numbers marked "typical" as a starting point and confirm them in the official documentation before you rely on them. Two small runnable stand-ins at the end do the CIDR and SLA arithmetic and validate resource names, because those are the checks you repeat most.

az CLI essentials

The shape is always az <group> <subgroup> <command> --options. Add -o table for readable output, -o json for scripts, --query (JMESPath) to pick fields, and --help anywhere. See Portal, Azure CLI and PowerShell.

Terminal
# Sign-in and context
az login
az account list -o table
az account set --subscription "My Subscription"
az account show --query "{name:name, id:id, tenant:tenantId}" -o json

# Resource groups and generic resources
az group create --name rg-demo --location westeurope
az group delete --name rg-demo --yes --no-wait
az resource list --resource-group rg-demo -o table
az tag update --resource-id <id> --operation merge --tags owner=team-a env=dev

# Registering providers and checking quota
az provider register --namespace Microsoft.ContainerService
az vm list-usage --location westeurope -o table
az vm list-skus --location westeurope --size Standard_D --all -o table
Task Command (core part)
Create a VM az vm create -g rg -n vm1 --image Ubuntu2204 --size Standard_B2s --admin-username azureuser --generate-ssh-keys
Stop billing for a VM az vm deallocate -g rg -n vm1
Start / restart az vm start -g rg -n vm1 / az vm restart -g rg -n vm1
Create a web app az webapp up --name app-demo-123 --runtime "NODE:20-lts"
Set app settings az webapp config appsettings set -g rg -n app --settings KEY=value
Function app az functionapp create -g rg -n func-demo --storage-account stdemo --consumption-plan-location westeurope --runtime node --functions-version 4
Storage account az storage account create -g rg -n stdemo001 --sku Standard_LRS --kind StorageV2
Upload a blob az storage blob upload --account-name stdemo001 -c data -f file.txt -n file.txt --auth-mode login
Virtual network az network vnet create -g rg -n vnet1 --address-prefixes 10.10.0.0/16 --subnet-name snet-web --subnet-prefixes 10.10.1.0/24
NSG rule az network nsg rule create -g rg --nsg-name nsg1 -n allow-https --priority 100 --access Allow --protocol Tcp --destination-port-ranges 443
Key Vault secret az keyvault secret set --vault-name kv-demo -n db-pass --value <value>
Role assignment az role assignment create --assignee <id> --role Reader --scope <scope>
Deploy Bicep az deployment group create -g rg --template-file main.bicep --parameters env=dev
Preview changes az deployment group what-if -g rg --template-file main.bicep
Container image build az acr build --registry acrdemo --image api:v1 .
Container app az containerapp up --name api --resource-group rg --source .
AKS credentials az aks get-credentials -g rg -n aks-demo
Query many resources az graph query -q "resources | summarize count() by type" (needs the resource-graph extension)

Add --no-wait to long operations and --yes to skip confirmation prompts in scripts. Pipelines should log in with OIDC, not a stored secret (CI/CD Pipelines).

Which service?

Need Reach for Lesson
Full OS control, legacy software Virtual Machines Virtual Machines
Managed web app or API App Service App Service
Event-driven code, pay per run Azure Functions Azure Functions
Containers, scale to zero, no cluster Container Apps Container Apps
Full Kubernetes API AKS AKS
Store container images Container Registry Container Registry
Files, images, backups, data lake Blob Storage Storage Accounts and Blobs
SMB/NFS file share Azure Files Files, Queues and Tables
Relational database (SQL Server engine) Azure SQL Database Azure SQL
Open-source relational or cache PostgreSQL / MySQL Flexible Server, Azure Cache for Redis Managed Databases
Global, low-latency NoSQL Cosmos DB Cosmos DB
Reliable business messages Service Bus Service Bus
Reactive event routing Event Grid Event Grid and Event Hubs
Streaming telemetry at high volume Event Hubs Event Grid and Event Hubs
Workflows and connectors, API gateway Logic Apps, API Management Logic Apps and API Management
Secrets, keys, certificates Key Vault Key Vault
Regional layer-7 balancing and WAF Application Gateway Load Balancing
Global entry point, CDN, WAF Front Door Load Balancing
Private access to a PaaS service Private Endpoint Private Connectivity
Logs, metrics, alerts Azure Monitor, Log Analytics, Application Insights Azure Monitor
Posture and threat protection Defender for Cloud Security and Defender

Scope hierarchy and RBAC

flowchart TB
    T["Tenant (Entra ID)"] --> MG["Management groups"]
    MG --> S["Subscriptions"]
    S --> RG["Resource groups"]
    RG --> R["Resources"]

RBAC assignments, policies and locks flow downward through this hierarchy.

Built-in role Can
Reader View everything in scope, change nothing
Contributor Create and manage resources, but not grant access
Owner Everything, including granting access
User Access Administrator Manage access only

Assign roles to groups, at the narrowest scope that works (Role-Based Access Control).

Naming: rules and prefixes

Follow a pattern such as <prefix>-<workload>-<env>-<region>-<nn>, for example vnet-shop-prod-weu-01. Common prefixes from the Cloud Adoption Framework abbreviations:

Resource Prefix Resource Prefix
Resource group rg- Virtual network vnet-
Subnet snet- Network security group nsg-
Public IP pip- Network interface nic-
Virtual machine vm- Storage account st (no hyphens)
Key Vault kv- App Service app app-
Function app func- App Service plan asp-
SQL server sql- SQL database sqldb-
Container registry cr (no hyphens) Log Analytics workspace log-
Application Insights appi- AKS cluster aks-

Rules that cause failed deployments (typical, check the docs for the service you use):

  • Storage account: 3 to 24 characters, lowercase letters and digits only, globally unique.
  • Key Vault: 3 to 24 characters, letters, digits and hyphens, starts with a letter, globally unique.
  • Resource group: 1 to 90 characters, unique within the subscription.
  • Windows VM computer name: up to 15 characters. Linux: up to 64.
  • Container registry: 5 to 50 characters, letters and digits only, globally unique.
  • Tags: up to 50 per resource. Enforce a standard (owner, costCenter, env) with a policy.

Limits worth remembering

Item Typical value
Reserved IPs per subnet 5 (so a /24 gives 251 usable)
Smallest subnet /29
GatewaySubnet /27 or larger recommended
AzureBastionSubnet, AzureFirewallSubnet /26 or larger
Storage queue message up to 64 KB
Service Bus message 256 KB (Standard), larger in Premium
Event Hubs event about 1 MB
Cosmos DB item up to 2 MB
Cosmos DB point read of a 1 KB item 1 request unit
Functions consumption timeout 5 minutes by default, 10 at most

Quota limits (for example vCPUs per VM family per region) are per subscription and can be raised by request; check az vm list-usage before a launch.

CIDR quick math

A prefix /n has 2^(32 - n) addresses. Azure keeps five per subnet.

Prefix Addresses Usable in Azure
/16 65,536 65,531
/20 4,096 4,091
/22 1,024 1,019
/24 256 251
/25 128 123
/26 64 59
/27 32 27
/28 16 11
/29 8 3

Each step of 1 in the prefix halves or doubles the size. Peered or connected networks must not overlap (Virtual Networks and Subnets).

SLA quick math

Availability Downtime per 30-day month Downtime per year
99% 7.2 hours 3.65 days
99.9% 43.2 minutes 8.76 hours
99.95% 21.6 minutes 4.38 hours
99.99% 4.32 minutes 52.6 minutes
99.999% 26 seconds 5.26 minutes

Components in series multiply (A x B x C). Independent copies in parallel combine as 1 - (1 - A) x (1 - A). See High Availability, Backup and Disaster Recovery.

KQL snippets

Time filter first, then filter, then aggregate. Table and column names below are those of workspace-based Application Insights and the activity log (Azure Monitor).

KUSTO
// Failed requests per operation, last hour
AppRequests
| where TimeGenerated > ago(1h) and Success == false
| summarize failures = count() by Name
| top 5 by failures desc

// Slowest operations (95th percentile)
AppRequests
| where TimeGenerated > ago(24h)
| summarize p95 = percentile(DurationMs, 95), n = count() by Name
| where n > 10
| order by p95 desc

// Trend over time, as a chart
AppRequests
| where TimeGenerated > ago(6h)
| summarize requests = count() by bin(TimeGenerated, 10m)
| render timechart

// Who changed what? (activity log)
AzureActivity
| where TimeGenerated > ago(7d) and ActivityStatusValue == "Success"
| project TimeGenerated, Caller, OperationNameValue, ResourceGroup
| order by TimeGenerated desc

// Machines that stopped sending heartbeats
Heartbeat
| summarize last = max(TimeGenerated) by Computer
| where last < ago(15m)

Two stand-ins for the math you repeat

These run in your browser and are not Azure. The first prints CIDR and SLA tables from the formulas, so you can check any value on this page. The second validates resource names against the typical rules above and builds names from the prefix pattern.

JS CIDR and SLA calculator

Press Run (or Ctrl + Enter) to see the console output here.

No output.

JS Resource name builder and validator

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The validator is a deliberate simplification: real services have a few extra rules (reserved words, forbidden endings), so a name that passes here can still be rejected by Azure.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. How many usable addresses does a /27 subnet have in Azure?

    A /27 has 32 addresses and Azure reserves five of them, which leaves 27.
  2. 2. Which command stops compute billing for a VM?

    Deallocating releases the compute. az vm stop leaves the VM allocated (and billed), the same as shutting it down from inside the OS.
  3. 3. What downtime does a 99.9% availability target allow per 30-day month?

    0.1 percent of 43,200 minutes is 43.2 minutes.
  4. 4. Which names can use hyphens?

    Key Vault names allow letters, digits and hyphens. Storage account and container registry names are letters and digits only.

Summary

  • Learn the az command shape, -o table, --query and the deallocate versus stop difference.
  • Use the service table to shortlist, then read the lesson to decide.
  • Name resources with a prefix pattern and remember the strict rules for storage accounts and Key Vaults.
  • CIDR: 2^(32 - n) addresses minus five per subnet; SLA: series multiplies, parallel combines unavailabilities.
  • Start KQL with a time filter, then filter, then summarize.

This is the last lesson of the Azure track. Revisit Practice: Azure Exercises with Solutions to test yourself, or return to Azure at a Glance.