Written and maintained by Victor Nwoke. Technical behavior is reviewed against the primary references listed on this page.
On this page
Overview
Azure organizes everything you create into a hierarchy, management groups, subscriptions, resource groups, and individual resources, and understanding that hierarchy matters more than understanding any single resource type, because it's where access control, policy enforcement, and cost management actually happen. Every operation, regardless of whether it comes from the Portal, CLI, or an infrastructure-as-code tool, goes through Azure Resource Manager (ARM), which is what makes that hierarchy consistently enforceable no matter how a change was made.
Quick Reference
Level
Purpose
Deleting it
Management group
Governance (policy, RBAC) across multiple subscriptions
Doesn't delete subscriptions, just removes grouping
Subscription
Billing and access-management boundary
Requires explicit cancellation, resources first
Resource group
Logical container for resources sharing a lifecycle
Deletes every resource inside it
Resource
An individual manageable object (VM, storage account...)
Deletes just that resource
The commands below are grouped by resource type, not an exhaustive reference (see the official Azure CLI reference for every flag), but the set that covers nearly all day-to-day az CLI work.
Command
Description
Copy
az login
Sign in interactively, via the browser.
az account show
Show the currently active subscription.
az account list
List every subscription available to the signed-in account.
az account set --subscription <id>
Switch the active subscription for subsequent commands.
Command
Description
Copy
az group create --name <rg> --location eastus
Create a resource group in a region.
az group exists --name <rg>
Return true or false without failing when checking whether a resource group exists.
az group list
List resource groups in the active subscription.
az group show --name <rg>
Show details of a resource group.
az group delete --name <rg>
Delete a resource group and every resource inside it.
Command
Description
Copy
az vm create --resource-group <rg> --name <vm> --image Ubuntu2404
Create a virtual machine.
az vm list
List VMs in the active subscription.
az vm start --resource-group <rg> --name <vm>
Start a stopped VM.
az vm deallocate --resource-group <rg> --name <vm>
Stop a VM and release its compute allocation, so it stops incurring compute charges.
Command
Description
Copy
az storage account create --name <name> --resource-group <rg> --sku Standard_LRS
Create a storage account.
az storage container create --name <name> --account-name <account> --auth-mode login
Create a blob container using the signed-in Entra identity rather than retrieving an account key.
Upload a local file as a blob using Entra authorization.
az storage account list
List storage accounts in the active subscription.
Command
Description
Copy
az aks create --resource-group <rg> --name <cluster> --node-count 3 --generate-ssh-keys
Create an AKS (managed Kubernetes) cluster. --generate-ssh-keys generates an SSH key pair automatically if one doesn't already exist, so the command succeeds even on a machine with no existing public key.
az aks get-credentials --resource-group <rg> --name <cluster>
Fetch cluster credentials into kubeconfig, so kubectl can target the cluster.
az aks list
List AKS clusters in the active subscription.
az aks scale --resource-group <rg> --name <cluster> --node-count 5
Scale an AKS cluster's node pool.
Command
Description
Copy
az monitor metrics list --resource <id>
Query metrics for a specific resource.
az monitor activity-log list
List subscription activity log events (who did what, and when).
az monitor log-analytics query --workspace <id> --analytics-query "<KQL>"
Run a Kusto (KQL) query against a Log Analytics workspace.
Command
Description
Copy
az deployment group what-if --resource-group <rg> --template-file main.bicep
Preview how a resource-group deployment would change resources before executing it.
az deployment group validate --resource-group <rg> --template-file main.bicep
Validate a resource-group deployment without creating resources.
az deployment operation group list --resource-group <rg> --name <deployment>
List per-resource operations and errors for a deployment.
az monitor activity-log list --resource-group <rg>
Inspect subscription control-plane events for a resource group.
Syntax
bash
az group create --name rg-app-prod --location eastusaz deployment group what-if \ --resource-group rg-app-prod \ --template-file main.bicepaz deployment group create \ --resource-group rg-app-prod \ --template-file main.bicep
Examples
bicep
// main.bicep, declarative resource definition, deployed// through Azure Resource Manager like every other Azure change.resource storage 'Microsoft.Storage/storageAccounts@2023-01-01' = { name: 'appuploadsprod' location: resourceGroup().location sku: { name: 'Standard_LRS' } kind: 'StorageV2'}
Deleting a resource group deletes everything in it
There's no confirmation beyond the initial prompt, and it cascades to every resource the group contains. Treat resource-group deletion with the same care as a destructive database operation.
Troubleshooting Azure Operations
I start with context, then move from Resource Manager to the resource itself:
Subscription and tenant: run az account show and compare the subscription and tenant IDs with the resource ID. A valid sign-in to the wrong subscription commonly appears as ResourceNotFound.
Template validation: run az deployment group validate and what-if before deployment. Resolve schema, parameter, policy, quota, and permission failures before retrying.
Deployment operations: for a failed deployment, list its operations and inspect the innermost error code, message, target resource, and correlation ID. The top-level DeploymentFailed message is only a wrapper.
Control plane: query the Azure Activity Log for create, update, delete, policy, RBAC, and service-health events. Activity Log covers subscription-level control-plane events; it is not an application's stdout or a storage data-access log.
Data plane and runtime: move to the service's resource logs, metrics, health checks, and dependency telemetry. Diagnostic settings must usually be configured to route resource logs to a destination such as Log Analytics.
For storage data operations, use --auth-mode login and confirm that the signed-in principal has a Blob Data role at the correct scope. Without that option, some Azure CLI storage commands may attempt to retrieve and use an account key, hiding a missing data-plane RBAC assignment.
Visual Diagram
Management group
Subscription
Resource group
Resource
The Azure resource hierarchy
Common Mistakes
Putting unrelated resources with different lifecycles into the same resource group, making it impossible to delete or manage one without affecting the others.
Managing access at the individual-resource level instead of at the resource-group or subscription level, creating an unmanageable sprawl of one-off role assignments.
Ignoring management groups entirely and configuring policy per-subscription, which doesn't scale past a handful of subscriptions and drifts out of consistency over time.
Assuming the Portal, CLI, and ARM templates behave differently; they're all just different clients of the same Resource Manager API and produce identical results for identical input.
Treating the top-level DeploymentFailed message as the root cause instead of inspecting the failed deployment operation and its inner error.
Expecting the Activity Log to contain application or data-plane logs, even though resource logs require their own diagnostic settings.
Performance
ARM deployment speed scales with the number of resources and their interdependencies in a single deployment, very large templates benefit from being split into modules deployed independently where dependencies allow.
Resource group and subscription structure has no runtime performance impact on the resources themselves; it's purely a management/governance concern, not a latency one.
Best Practices
Group resources by lifecycle, not by resource type, everything in a resource group should reasonably be created and deleted together.
I use management groups and Azure Policy to enforce organization-wide rules once, rather than per-subscription.
Assign RBAC roles at the resource-group or subscription level whenever the access genuinely applies that broadly, instead of per-resource.
Adopt a consistent subscription strategy (e.g., separate subscriptions per environment or business unit) before resource sprawl makes retrofitting one expensive.
Preview Bicep changes with what-if, preserve deployment names and correlation IDs in CI, and inspect deployment operations before retrying a failed rollout.
What is the difference between a resource group and a subscription in Azure?
A subscription is a billing and access-management boundary; it's tied to an agreement with Microsoft, has its own spending limits and quotas, and is typically the unit organizations use to separate environments (production vs. non-production) or business units. A resource group is a logical container inside a subscription that groups related resources (a VM, its disks, its network interface) that share the same lifecycle, created and deleted together. Deleting a resource group deletes everything in it, which makes resource groups the practical unit of "this is one deployable thing," while subscriptions are the practical unit of "this is one billing and governance boundary."
What is Azure Resource Manager (ARM) and why does every Azure operation go through it?
ARM is the deployment and management layer that every Azure operation, whether from the Portal, CLI, PowerShell, or an ARM/Bicep template, ultimately goes through. It provides a consistent API surface, handles authentication and authorization checks against Azure RBAC, and is what enables declarative deployment (submit a template describing desired resources, ARM figures out what to create/update). Because every path converges on ARM, access control and activity logging are consistent regardless of which tool was used to make a change.
How do management groups extend governance above the subscription level?
Management groups let an organization apply policies (via Azure Policy) and role assignments (via Azure RBAC) across multiple subscriptions at once, instead of configuring each subscription independently. They form a hierarchy above subscriptions, a root management group can contain child management groups (e.g., by department or environment type), each containing multiple subscriptions, so a single policy assignment at the right level of that hierarchy can enforce a rule (like "no public IP addresses" or "must use approved regions") across every subscription beneath it.