az --helpDisplays the global help menu and available command groups.
Microsoft’s cross-platform CLI for Azure: manage subscriptions, Entra ID, VMs, storage and networking, and review security posture.
brew install azure-cliaz configureInteractively manages default settings such as output format and logging.
az extension addInstalls a specific Azure CLI extension to add functionality.
Example
az extension add --name bastionaz loginInitiates the interactive login process via the default web browser.
az login --use-device-codeLogs in using a device code, suitable for terminals without browsers.
az login --service-principalAuthenticates using a service principal for automation workflows.
Example
az login --service-principal -u <app-id> -p <password> --tenant <tenant-id>az account listLists all subscriptions available to the logged-in account.
Example
az account list --output tableaz account setSets the active subscription for subsequent commands.
Example
az account set --subscription <subscription-id>az account showDisplays details of the currently active subscription.
az group createCreates a new resource group in a specific region.
Example
az group create --name MyResourceGroup --location eastusaz group listLists all resource groups in the current subscription.
Example
az group list --output tableaz group showGets the metadata and properties of a specific resource group.
Example
az group show --name MyResourceGroupaz resource listLists all resources contained within a specific resource group.
Example
az resource list --resource-group MyResourceGroupaz group lock createApplies a management lock to prevent accidental deletion of the group.
Example
az group lock create --lock-type CanNotDelete --name LockGroup --resource-group MyResourceGroupaz vm list-skusLists available virtual machine sizes and SKUs in a region.
Example
az vm list-skus --location eastus --output tableaz vm createCreates a Linux virtual machine with SSH key authentication.
Example
az vm create --resource-group MyRG --name MyVM --image Ubuntu2204 --admin-username azureuser --generate-ssh-keysaz vm listLists all VMs with their power state and IP details.
Example
az vm list --show-details --output tableaz vm showRetrieves detailed configuration information for a specific VM.
Example
az vm show --resource-group MyRG --name MyVMaz vm open-portOpens a network port on the VM's associated network security group.
Example
az vm open-port --resource-group MyRG --name MyVM --port 80az vm stopPower off a virtual machine (deallocates compute resources).
Example
az vm stop --resource-group MyRG --name MyVMaz vm startStarts a stopped virtual machine.
Example
az vm start --resource-group MyRG --name MyVMaz vm run-command invokeExecutes a shell script inside the VM using the VM Agent.
Example
az vm run-command invoke --command-id RunShellScript --name MyVM --resource-group MyRG --scripts "uname -a"az disk listLists managed disks associated with a resource group.
Example
az disk list --resource-group MyRGaz snapshot createCreates a point-in-time snapshot of a managed disk.
Example
az snapshot create --name MySnapshot --resource-group MyRG --source MyDiskaz network vnet createCreates a virtual network with a specified address space.
Example
az network vnet create --resource-group MyRG --name MyVNet --address-prefix 10.0.0.0/16az network vnet subnet createAdds a subnet to an existing virtual network.
Example
az network vnet subnet create --resource-group MyRG --vnet-name MyVNet --name MySubnet --address-prefixes 10.0.1.0/24az network public-ip createCreates a public IP address resource.
Example
az network public-ip create --resource-group MyRG --name MyPublicIP --sku Standardaz network nsg createCreates a Network Security Group for traffic filtering.
Example
az network nsg create --resource-group MyRG --name MyNSGaz network nsg rule createAdds an inbound security rule to an NSG.
Example
az network nsg rule create --resource-group MyRG --nsg-name MyNSG --name AllowSSH --priority 1000 --destination-port-ranges 22 --access Allow --protocol Tcpaz network nsg rule listLists all rules defined in a Network Security Group.
Example
az network nsg rule list --resource-group MyRG --nsg-name MyNSGaz network nic createCreates a network interface card and attaches it to a subnet and NSG.
Example
az network nic create --resource-group MyRG --name MyNIC --vnet-name MyVNet --subnet MySubnet --network-security-group MyNSGaz storage account createCreates a general-purpose storage account.
Example
az storage account create --name mystorageacct --resource-group MyRG --location eastus --sku Standard_LRSaz storage account keys listLists the access keys for a storage account (Handle with care).
Example
az storage account keys list --resource-group MyRG --account-name mystorageacctaz storage container createCreates a blob container within a storage account.
Example
az storage container create --name mycontainer --account-name mystorageacctaz storage blob uploadUploads a local file to a storage container as a blob.
Example
az storage blob upload --container-name mycontainer --file /path/to/file --name myblob --account-name mystorageacctaz storage blob listLists all blobs contained in a specific container.
Example
az storage blob list --container-name mycontainer --account-name mystorageacct --output tableaz ad user listLists all users in the Azure Active Directory tenant.
Example
az ad user list --output tableaz ad user showGets specific details about an Azure AD user.
Example
az ad user show --id user@example.comaz ad group createCreates a new security group in Azure AD.
Example
az ad group create --display-name MyGroup --mail-nickname MyGroupaz ad group member addAdds a user or service principal to a group.
Example
az ad group member add --group MyGroup --member-id <object-id>az ad sp create-for-rbacCreates a service principal and assigns it a role.
Example
az ad sp create-for-rbac --name MyServicePrincipalaz role definition listLists details of a specific role definition.
Example
az role definition list --name "Contributor"az role assignment createAssigns a role to a user or principal at a specific scope.
Example
az role assignment create --assignee <user-email> --role Reader --scope /subscriptions/<sub-id>az role assignment listLists all roles assigned to a specific user.
Example
az role assignment list --assignee <user-email> --allaz keyvault createCreates an Azure Key Vault for managing secrets and keys.
Example
az keyvault create --name MyKeyVault --resource-group MyRG --location eastusaz keyvault secret setStores a secret value in the Key Vault.
Example
az keyvault secret set --vault-name MyKeyVault --name MySecret --value "Sup3rS3cur3"az keyvault secret showRetrieves the value of a secret from the Key Vault.
Example
az keyvault secret show --vault-name MyKeyVault --name MySecretaz webapp listLists all web applications in a resource group.
Example
az webapp list --resource-group MyRGaz appservice plan createCreates an App Service plan to host web apps.
Example
az appservice plan create --name MyPlan --resource-group MyRG --sku B1az webapp createCreates a web application running a specific runtime.
Example
az webapp create --resource-group MyRG --plan MyPlan --name MyUniqueAppName --runtime "NODE|18-lts"az aks createCreates a managed Kubernetes cluster.
Example
az aks create --resource-group MyRG --name MyCluster --node-count 1 --generate-ssh-keysaz aks get-credentialsConfigures the local kubectl to connect to the AKS cluster.
Example
az aks get-credentials --resource-group MyRG --name MyClusteraz sql server createCreates a logical SQL server.
Example
az sql server create --name myserver --resource-group MyRG --location eastus --admin-user myadmin --admin-password <password>az sql db createCreates a SQL database within a logical server.
Example
az sql db create --resource-group MyRG --server myserver --name mydb --service-objective S0az sql server firewall-rule createAllows access to the SQL server from a specific IP address.
Example
az sql server firewall-rule create --resource-group MyRG --server myserver --name AllowMyIP --start-ip-address <ip> --end-ip-address <ip>az monitor activity-log listLists activity log events for the subscription from the last hour.
Example
az monitor activity-log list --offset 1haz monitor metrics listRetrieves metric definitions and values for a resource.
Example
az monitor metrics list --resource <resource-id> --metric "Percentage CPU"az monitor diagnostic-settings createConfigures streaming of logs to a Log Analytics workspace.
Example
az monitor diagnostic-settings create --name MyDiag --resource <resource-id> --logs '[{"category": "Write", "enabled": true}]' --workspace <workspace-id>az vm list --queryFilters and projects specific fields from the output using JMESPath.
Example
az vm list --query "[].{Name:name, OS:storageProfile.osDisk.osType}"az vm list --query (Filter)Filters the list to show only resources in a specific location.
Example
az vm list --query "[?location=='eastus']"az policy definition listLists built-in Azure policy definitions.
Example
az policy definition list --query "[?policyType=='BuiltIn']"az policy assignment createAssigns a policy to a scope to enforce compliance.
Example
az policy assignment create --name 'audit-vm-managed-disks' --policy <policy-id> --scope <scope-id>az network nsg rule list (Audit)Audits NSGs to find rules that allow all inbound traffic.
Example
az network nsg rule list --query "[?access=='Allow' && direction=='Inbound' && destinationPortRange=='*']"az network public-ip listLists all public IP addresses and shows what they are attached to.
Example
az network public-ip list --query "[].{Name:name, IP:ipAddress, Associated:ipConfiguration.id}"az network watcher test-ip-flowVerifies if traffic is allowed or denied to a VM based on effective security rules.
Example
az network watcher test-ip-flow --vm <vm> --direction Inbound --protocol TCP --local-port 80 --remote-ip <ip>az role assignment list (Privileged)Audits all users who have the Owner role on the subscription.
Example
az role assignment list --role "Owner" --include-inheritedaz ad user list (Guest)Identifies all guest users existing in the Azure Active Directory.
Example
az ad user list --filter "userType eq 'Guest'"az storage account list (Public Access)Finds storage accounts that allow public access to blobs.
Example
az storage account list --query "[?allowBlobPublicAccess==`true`].{Name:name}"az keyvault list (Deleted)Lists soft-deleted Key Vaults to detect potential data loss or recovery needs.
Example
az keyvault list-deletedaz security alert listLists active security alerts from Microsoft Defender for Cloud.
Example
az security alert list --status Activeaz security score listRetrieves the current Secure Score for the subscription.
az security jit-policy listLists Just-In-Time access policies configured for VMs.
az monitor activity-log list (Filter)Investigates all actions performed by a specific user since a given time.
Example
az monitor activity-log list --caller <suspect-email> --start-time <iso-timestamp>az vm run-command invoke (Forensics)Remotely executes netstat on a compromised VM to identify active connections.
Example
az vm run-command invoke --command-id RunShellScript --name <vm> --resource-group <rg> --scripts "netstat -anp"az snapshot create (Forensics)Creates a forensic copy of a disk for offline analysis.
Example
az snapshot create --name ForensicSnap --resource-group <rg> --source <compromised-disk-id>az network watcher packet-capture createStarts a packet capture on a VM to analyze network traffic patterns.
Example
az network watcher packet-capture create --vm <vm> --resource-group <rg> --name Capture1az deployment group createDeploys infrastructure as code using an ARM template or Bicep file.
Example
az deployment group create --resource-group MyRG --template-file main.bicepaz deployment group validateValidates a template syntax and configuration without deploying it.
Example
az deployment group validate --resource-group MyRG --template-file main.bicepaz deployment operation listLists the individual operations within a deployment for debugging.
Example
az deployment operation list --name <deployment-name> --resource-group MyRGaz network lb createCreates a standard Layer 4 Load Balancer.
Example
az network lb create --resource-group MyRG --name MyLB --sku Standardaz network lb probe createCreates a health probe to monitor backend instances.
Example
az network lb probe create --lb-name MyLB --resource-group MyRG --name HealthProbe --protocol Tcp --port 80az network lb rule createCreates a load balancing rule forwarding traffic from frontend to backend.
Example
az network lb rule create --lb-name MyLB --resource-group MyRG --name Rule1 --protocol Tcp --frontend-port 80 --backend-port 80 --probe-name HealthProbeaz network application-gateway createCreates a Layer 7 Application Gateway for web traffic management.
Example
az network application-gateway create --resource-group MyRG --name MyAppGW --sku Standard_v2az consumption usage listLists usage details for billing analysis.
Example
az consumption usage list --start-date 2023-01-01 --end-date 2023-01-31az consumption budget createCreates a budget to monitor spending.
Example
az consumption budget create --amount 100 --budget-name MyBudget --category cost --start-date 2023-01-01 --time-grain Monthlyaz consumption usage listForces Microsoft billing API extractions bypassing graphical dashboards delivering raw transactional utilization metrics.
Example
az consumption usage list --start-date 2023-01-01 --end-date 2023-01-31az pipelines listLists Azure DevOps pipelines (requires azure-devops extension).
Example
az pipelines list --organization https://dev.azure.com/myorg --project myprojectaz repos listLists Git repositories in Azure DevOps.
Example
az repos list --organization https://dev.azure.com/myorg --project myprojectaz functionapp createCreates a serverless Function App.
Example
az functionapp create --resource-group MyRG --consumption-plan-location eastus --runtime python --runtime-version 3.9 --functions-version 4 --name MyFuncApp --storage-account mystorageacctaz functionapp deployment source config-zipDeploys code to a Function App from a zip file.
Example
az functionapp deployment source config-zip --resource-group MyRG --name MyFuncApp --src app.zipaz disk list (Encryption)Audits managed disks to find those without encryption enabled.
Example
az disk list --query "[?encryptionSettingsCollection.enabled!=`true`].{Name:name, Encrypted:encryptionSettingsCollection.enabled}"az sql server audit-policy showChecks the auditing policy of a SQL server.
Example
az sql server audit-policy show --resource-group MyRG --server myserveraz keyvault certificate createCreates a self-signed certificate inside Key Vault.
Example
az keyvault certificate create --vault-name MyKeyVault --name MyCert --policy "$(az keyvault certificate get-default-policy)"az keyvault key createCreates a cryptographic key in Key Vault.
Example
az keyvault key create --vault-name MyKeyVault --name MyKey --kty RSAaz network firewall createCreates an Azure Firewall resource.
Example
az network firewall create --name MyFirewall --resource-group MyRG --location eastusaz network firewall network-rule createAdds a network rule to the Azure Firewall.
Example
az network firewall network-rule create --firewall-name MyFirewall --collection-name MyRuleCollection --name AllowDNS --protocols UDP --source-addresses * --destination-addresses * --destination-ports 53 --action Allow --priority 100 --resource-group MyRGaz arcappliance listLists Azure Arc appliances for hybrid cloud management.
Example
az arcappliance list --resource-group MyRGaz logic workflow createCreates a Logic App workflow from a JSON definition.
Example
az logic workflow create --resource-group MyRG --location eastus --name MyWorkflow --definition definition.jsonaz logic workflow showExtrapolates full automation configuration trees evaluating structural pipeline integrations.
Example
az logic workflow show --resource-group rg --name myWorkflowaz container createCreates a single container instance (ACI) accessible via a public IP.
Example
az container create --resource-group MyRG --name MyContainer --image nginx --dns-name-label mynginx --ports 80az container logsRetrieves logs from a container instance.
Example
az container logs --resource-group MyRG --name MyContaineraz network traffic-manager profile createCreates a Traffic Manager profile for global DNS load balancing.
Example
az network traffic-manager profile create --resource-group MyRG --name MyTMProfile --routing-method Priority --unique-dns-name myapp-tmaz network front-door createCreates an Azure Front Door for global web traffic acceleration.
Example
az network front-door create --resource-group MyRG --name MyFrontDoor --backend-address www.example.comaz resource list (Orphans)Lists resources that are not managed by another resource (potential orphans).
Example
az resource list --query "[?managedBy==null]"az monitor log-analytics workspace listLists Log Analytics workspaces used for log aggregation.
az monitor autoscale setting listLists autoscale settings configured for resources.
Example
az monitor autoscale setting list --resource-group MyRGaz network watcher troubleshooting startStarts a troubleshooting session on a VPN Gateway or Connection.
Example
az network watcher troubleshooting start --resource-group MyRG --resource <vpn-gateway-id> --storage-account <storage-id> --storage-path <url>az webapp log tailStreams live logs from a Web App to the console.
Example
az webapp log tail --resource-group MyRG --name MyWebAppaz batch account createCreates an Azure Batch account for large-scale parallel computing.
Example
az batch account create --resource-group MyRG --name mybatch --location eastusaz cognitiveservices account createCreates a Cognitive Services account.
Example
az cognitiveservices account create --name MyCognitive --resource-group MyRG --kind Face --sku S0 --location eastusaz signalr createCreates a SignalR Service for real-time web functionality.
Example
az signalr create --name MySignalR --resource-group MyRG --sku Standard_S1az redis createCreates a Redis Cache instance.
Example
az redis create --name MyRedis --resource-group MyRG --location eastus --sku Basic --vm-size c0az network private-endpoint createCreates a private endpoint to securely connect to PaaS services.
Example
az network private-endpoint create --name MyPE --resource-group MyRG --vnet-name MyVNet --subnet MySubnet --private-connection-resource-id <id> --group-id blob --connection-name MyConnectionaz network private-dns zone createCreates a private DNS zone for resolving private endpoint IPs.
Example
az network private-dns zone create --resource-group MyRG --name privatelink.blob.core.windows.netaz network private-dns link vnet createLinks a private DNS zone to a virtual network.
Example
az network private-dns link vnet create --resource-group MyRG --zone-name privatelink.blob.core.windows.net --name MyLink --virtual-network MyVNet --registration-enabled falseaz cdn profile createCreates a Content Delivery Network profile.
Example
az cdn profile create --resource-group MyRG --name MyCDNProfile --sku Standard_Akamaiaz servicebus namespace createCreates a Service Bus namespace for enterprise messaging.
Example
az servicebus namespace create --resource-group MyRG --name MySBNamespace --sku Standardaz servicebus queue createCreates a queue within a Service Bus namespace.
Example
az servicebus queue create --resource-group MyRG --namespace-name MySBNamespace --name MyQueueaz kusto cluster createCreates an Azure Data Explorer cluster.
Example
az kusto cluster create --resource-group MyRG --name MyKustoCluster --sku name=Standard_D13_v2 tier=Standardaz bot createCreates a Bot Service registration.
Example
az bot create --resource-group MyRG --name MyBot --kind WebApp --appid <appid> --password <password>az blueprint createCreates a blueprint definition for governance.
Example
az blueprint create --name MyBlueprint --target-scope subscriptionaz synapse workspace createCreates a Synapse Analytics workspace.
Example
az synapse workspace create --name MySynapse --resource-group MyRG --storage-account mystorageacct --file-system myfilesystem --sql-admin-login-user adminuseraz security pricing listLists the pricing tiers for Microsoft Defender for Cloud bundles.
az backup vault createCreates a Recovery Services vault for backups.
Example
az backup vault create --resource-group MyRG --name MyRecoveryVault --location eastusaz backup protection enable-for-vmEnables backup for a virtual machine.
Example
az backup protection enable-for-vm --resource-group MyRG --vault-name MyRecoveryVault --vm <vm-id> --policy-name DefaultPolicyaz account management-group listLists management groups to understand the organization hierarchy.
az resource deleteDeletes a specific resource by its ID.
Example
az resource delete --ids <resource-id>az group deleteDeletes a resource group and all contained resources asynchronously.
Example
az group delete --name MyResourceGroup --yes --no-waitaz ad app deleteDeletes an application registration from Azure AD.
Example
az ad app delete --id <app-id>az keyvault deleteDeletes a Key Vault (moves to soft-deleted state).
Example
az keyvault delete --name MyKeyVaultaz keyvault purgePermanently purges a soft-deleted Key Vault.
Example
az keyvault purge --name MyKeyVaultaz functionapp createBoots dynamic isolated serverless algorithmic workers bridging AppService endpoints natively.
Example
az functionapp create --resource-group myRG --consumption-plan-location westus --runtime nodeaz functionapp keys listExfiltrates the mandatory authorization connection strings fundamentally required to execute an HTTP-bound function.
Example
az functionapp keys list --name myFunc --resource-group myRGaz cosmosdb database createInstantiates globally replicated logic cores strictly optimized for massive globally asynchronous operations.
Example
az cosmosdb database create --account-name myCosmos --name coreDB --resource-group myRGaz cosmosdb keys listDecrypts and reveals the raw Read/Write master cryptographic passcodes governing universal database interconnectivity.
Example
az cosmosdb keys list --name myCosmos --resource-group myRGaz acr loginInjects native Azure AAD authentication logic directly into your local Docker daemon enabling immediate secure push/pull workflows.
Example
az acr login --name myAcrRegistryaz acr repository deleteSurgically excises compromised or bloated legacy Docker blobs natively restoring Azure bandwidth limits.
Example
az acr repository delete --name myAcr --image myApp:v1az keyvault secret setIngests raw unencrypted values encrypting them irreversibly within Azure's HSM arrays locking them onto specific app configurations.
Example
az keyvault secret set --vault-name myKeys --name 'db-password' --value 'SuperSecret123!'az keyvault secret showDecrypts explicitly requested secured strings into plaintext, dropping outputs strictly to the local CLI.
Example
az keyvault secret show --vault-name myKeys --name 'db-password' --query value