CLI & PowerShell Commands
Task, Azure CLI and PowerShell side by side for each domain, copied from the topic pages.
Every command here comes from a CLI or PowerShell table on an AZ-104 topic page. A - means the topic page gives no command for that tool. Placeholders such as <rg> are yours to fill in.
Reading a command
| Azure CLI | PowerShell |
|---|
| Shape | az <group> <subgroup> <verb>, then options such as -g (resource group) and -n (name) | Verb-AzNoun, then named parameters such as -ResourceGroupName and -Name |
| Create a VM | az vm create -n MyVm -g MyRG --image Ubuntu2204 --size Standard_D2s_v5 --generate-ssh-keys | New-AzVM -ResourceGroupName MyRG -Name MyVm -Credential (Get-Credential) -Image <img> -Size <size> -Zone 1 |
| Deploy to a resource group | az deployment group create -g <rg> --template-file main.bicep --parameters storageAccountType=Standard_GRS | New-AzResourceGroupDeployment -ResourceGroupName <rg> -TemplateFile main.bicep |
| Deallocate / start a VM | az vm deallocate / az vm start | Stop-AzVM / Start-AzVM |
| Change a SKU | az acr update --name myContainerRegistry --sku Premium | Update-AzContainerRegistry -ResourceGroupName myResourceGroup -Name myContainerRegistry -Sku Premium |
- In the Azure CLI the words after
az name the resource and the action (az vm, az network vnet subnet create, az role assignment create). In PowerShell the cmdlet carries the action first (New-, Get-, Set-, Update-, Remove-, Start-, Stop-) and the Az prefix marks the Az module. - The two tools don't always use the same word for the same thing. The same task can be
create in one and New- in the other, and az vm deallocate is Stop-AzVM. Policy initiatives are called PolicySet in the CLI and PowerShell. - Microsoft Entra tasks (users, licences, SSPR) use the Microsoft Graph PowerShell SDK, whose cmdlets start
Mg (for example Get-MgUser and Update-MgUser), not Az. - Defaults can differ between the tools. Bastion is one example: omit
--sku in the CLI and you get Standard, but -Sku defaults to Basic in PowerShell.
Topic pages: Virtual Machines, ARM Templates & Bicep, Containers, Azure Policy, Azure Bastion.
Manage Azure identities and governance (20–25%)
Azure Policy
| Task | Azure CLI | PowerShell |
|---|
| Assign with a managed identity | az policy assignment create ... --mi-system-assigned --location <loc> | New-AzPolicyAssignment ... -IdentityType SystemAssigned -Location <loc> |
| Create a remediation task | az policy remediation create --name myRemediation --policy-assignment <id> | Start-AzPolicyRemediation -Name myRemediation -PolicyAssignmentId <id> |
| Get a definition | az policy definition show | Get-AzPolicyDefinition |
Cost Management
| Task | Azure CLI | PowerShell |
|---|
| Create a budget on a resource group | az consumption budget create-with-rg --amount 100 --budget-name TestCLIBudget -g $rg --category Cost --time-grain Monthly --time-period '{...}' --notifications '{...}' | New-AzConsumptionBudget -Amount 100 -Name TestPSBudget -Category Cost -TimeGrain Monthly ... |
| Create an action group email receiver | az monitor action-group receiver email create --email-address test@test.com --name EmailReceiver1 --resource-group <rg> | New-AzActionGroupReceiver -EmailAddress test@test.com -Name EmailReceiver1 |
External Users
| Task | Azure CLI | PowerShell |
|---|
| Add a user to the Guest Inviter role | - | New-MgDirectoryRoleMemberByRef -DirectoryRoleId $role.Id -BodyParameter $DirObject |
Licensing
| Task | Azure CLI | PowerShell |
|---|
| Assign or remove a license on a group | - | Set-MgGroupLicense (Microsoft Graph PowerShell SDK) |
| Assign licenses to users | - | Microsoft Graph PowerShell SDK (the Microsoft page links to it) |
Locks & Tags
| Task | Azure CLI | PowerShell |
|---|
| Lock a resource group | az lock create --name LockGroup --lock-type CanNotDelete --resource-group exampleresourcegroup | New-AzResourceLock -LockName LockGroup -LockLevel CanNotDelete -ResourceGroupName exampleresourcegroup |
| Lock a resource | az lock create --name LockSite --lock-type CanNotDelete --resource-group <rg> --resource-name <n> --resource-type Microsoft.Web/sites | New-AzResourceLock -LockLevel CanNotDelete -LockName LockSite -ResourceName <n> -ResourceType Microsoft.Web/sites -ResourceGroupName <rg> |
| List locks | az lock list | Get-AzResourceLock |
| Delete a lock | az lock delete --ids <lockId> | Remove-AzResourceLock -LockId <id> |
| Set tags, replacing the whole set | az tag create --resource-id $resource --tags Dept=Finance Status=Normal | New-AzTag -ResourceId $resource.id -Tag $tags |
| Merge: add new names and update existing values, keep the rest | az tag update --resource-id <id> --operation Merge --tags key1=value1 | Update-AzTag -ResourceId <id> -Tag $tags -Operation Merge |
| Replace the whole set | az tag update --resource-id <id> --operation Replace --tags key1=value1 | Update-AzTag -ResourceId <id> -Tag $tags -Operation Replace |
| Delete only the named tags | az tag update --resource-id $resource --operation Delete --tags Project=ECommerce Team=Web | Update-AzTag -ResourceId $resource.id -Tag $removeTags -Operation Delete |
| Remove all tags | az tag delete --resource-id $resource | Remove-AzTag -ResourceId <id> |
| List tags | az tag list --resource-id $resource | Get-AzTag -ResourceId $resource.id |
| Find by tag | az resource list --tag CostCenter=00123 --query [].name | (Get-AzResource -Tag @{ "CostCenter"="00123"}).Name |
Azure RBAC
| Task | Azure CLI | PowerShell |
|---|
| Assign a role by object ID | az role assignment create --assignee-object-id <id> --role "Contributor" --scope <scope> | New-AzRoleAssignment (with -ObjectType for new principals) |
| List assignments at root | az role assignment list --role "User Access Administrator" --scope "/" | Get-AzRoleAssignment |
| Remove an assignment | az role assignment delete --assignee <upn> --role "User Access Administrator" --scope "/" | Remove-AzRoleAssignment -SignInName <upn> -RoleDefinitionName "User Access Administrator" -Scope "/" |
| Elevate access | az rest --method post --url "/providers/Microsoft.Authorization/elevateAccess?api-version=2016-07-01" | Use the portal or REST |
| List deny assignments | Not verified | Get-AzDenyAssignment |
| Find a role ID | az role definition list --name "Contributor" | n/a |
Self-Service Password Reset
| Task | Azure CLI | PowerShell |
|---|
| Disable SSPR for admins | - | Update-MgPolicyAuthorizationPolicy -AllowedToUseSspr:$false |
| Password never expires | - | Update-MgUser -UserId <id> -PasswordPolicies DisablePasswordExpiration |
| Make the password expire | - | Update-MgUser -UserId <id> -PasswordPolicies None |
| Check the flag | - | Get-MgUser -UserId <id> -Property UserPrincipalName, PasswordPolicies |
Subscriptions & Management Groups
| Task | Azure CLI | PowerShell |
|---|
| Create | az group create --name demoResourceGroup --location westus | New-AzResourceGroup -Name exampleGroup -Location westus |
| Delete | az group delete --name exampleGroup | Remove-AzResourceGroup -Name exampleGroup |
| List | az group list | Get-AzResourceGroup |
| Show | az group show --name exampleGroup | Get-AzResourceGroup -Name exampleGroup |
| Move | az resource move --destination-group newgroup --ids $webapp $plan (add --destination-subscription-id across subscriptions) | Move-AzResource -DestinationResourceGroupName <rg> -ResourceId <ids> (-DestinationSubscriptionId across subscriptions) |
| Validate without moving | az resource invoke-action --action validateMoveResources --ids <rgId> --request-body <json> | Invoke-AzResourceAction -Action validateMoveResources -ResourceId <rgId> -Parameters @{...} |
| Check tenant | az account show --subscription <s> --query tenantId | (Get-AzSubscription -SubscriptionName <s>).TenantId |
| Register a provider | az provider register --namespace Microsoft.Batch | Register-AzResourceProvider -ProviderNamespace Microsoft.Batch |
| Create | az account management-group create --name 'Contoso' --display-name 'Contoso Group' (add --parent for a different parent) | New-AzManagementGroup -GroupName 'Contoso' -DisplayName 'Contoso Group' |
| Rename | az account management-group update --name 'Contoso' --display-name 'Contoso Group' | Update-AzManagementGroup -GroupId 'ContosoIt' -DisplayName 'Contoso Group' |
| Delete | az account management-group delete --name 'Contoso' | Remove-AzManagementGroup -GroupId 'Contoso' |
| List or show | az account management-group list | Get-AzManagementGroup |
| Add a subscription | az account management-group subscription add --name 'Contoso' --subscription <id> | New-AzManagementGroupSubscription -GroupId 'Contoso' -SubscriptionId <id> |
| Remove a subscription | az account management-group subscription remove --name 'Contoso' --subscription <id> | Remove-AzManagementGroupSubscription -GroupId 'Contoso' -SubscriptionId <id> |
| Move a group under another | az account management-group update --name 'Contoso' --parent ContosoIT | Update-AzManagementGroup -GroupId 'Contoso' -ParentId $parentGroup.id |
Users & Groups
| Task | Azure CLI | PowerShell |
|---|
| List member users (verify a bulk create) | - | Get-MgUser -Filter "UserType eq 'Member'" |
| Check a user’s never-expire flag | - | Get-MgUser -UserId <id> -Property UserPrincipalName, PasswordPolicies |
| Find service plan IDs for a dynamic rule | - | Get-MgUser -UserId user@contoso.com -Property assignedPlans (scope User.Read.All) |
Topic pages: Azure Policy, Cost Management, External Users, Licensing, Locks & Tags, Azure RBAC, Self-Service Password Reset, Subscriptions & Management Groups, Users & Groups.
Deploy and manage Azure compute resources (20–25%)
App Service Configuration
| Task | Azure CLI | PowerShell |
|---|
| Create plan | az appservice plan create --name <plan> --resource-group <rg> --sku P0v3 --is-linux | New-AzAppServicePlan -Name <plan> -Location <loc> -ResourceGroupName <rg> -Tier Free |
| Create web app | az webapp create --name <app> --resource-group <rg> --plan <plan> --runtime "NODE:24LTS" | New-AzWebApp -Name <app> -Location <loc> -AppServicePlan <plan> -ResourceGroupName <rg> |
| Connection string | az webapp config connection-string set -g <rg> -n <app> --connection-string-type SQLAzure --settings N=V | Set-AzWebApp -ConnectionStrings $hash |
| Sticky setting | az webapp config appsettings set ... --settings K=V --slot-settings K | Set-AzWebAppSlotConfigName -ResourceGroupName <rg> -Name <app> -AppSettingNames K |
| Add custom domain | az webapp config hostname add --webapp-name <app> --resource-group <rg> --hostname <fqdn> | - |
| Upload PFX | az webapp config ssl upload --certificate-file <pfx> --certificate-password <pw> --name <app> --resource-group <rg> | New-AzWebAppSSLBinding -WebAppName <app> -ResourceGroupName <rg> -Name <fqdn> -CertificateFilePath <pfx> -CertificatePassword <pw> -SslState SniEnabled |
| Import from Key Vault | az webapp config ssl import --resource-group <rg> --name <app> --key-vault <vault> --key-vault-certificate-name <cert> | - |
| Bind certificate | az webapp config ssl bind --certificate-thumbprint <tp> --ssl-type SNI --name <app> --resource-group <rg> | New-AzWebAppSSLBinding ... -SslState SniEnabled |
| Key Vault access for App Service | az role assignment create --role "Key Vault Certificate User" --assignee abfa0a7c-a6b6-4736-8310-5855508787cd --scope <vault id> | New-AzRoleAssignment -RoleDefinitionName "Key Vault Certificate User" -ApplicationId abfa0a7c-a6b6-4736-8310-5855508787cd -Scope <vault id> |
| Custom backup (on demand) | az webapp config backup create --resource-group <rg> --webapp-name <app> --container-url "<SAS container url>" | - |
| List and restore backup | az webapp config backup list; az webapp config backup restore --backup-name <n> --container-url <url> --webapp-name <app> -g <rg> [--target-name] [--overwrite] [--slot] | - |
| Access restriction rule | az webapp config access-restriction add -g <rg> -n <app> --rule-name R --action Allow --ip-address 122.133.144.0/24 --priority 100 (also --service-tag, --http-header, --scm-site true) | Add-AzWebAppAccessRestrictionRule -ResourceGroupName <rg> -WebAppName <app> -Name R -Priority 100 -Action Allow -IpAddress 122.133.144.0/24 |
| Unmatched rule action | az resource update -g <rg> -n <app> --resource-type Microsoft.Web/sites --set properties.siteConfig.ipSecurityRestrictionsDefaultAction=Allow | Set-AzResource on the same property |
| VNet integration | az webapp vnet-integration add -g <rg> -n <app> --vnet <vnet> --subnet <subnet> | - |
| Create slot | az webapp deployment slot create --name <app> --resource-group <rg> --slot <slot> | New-AzWebAppSlot -ResourceGroupName <rg> -Name <app> -Slot <slot> -AppServicePlan <plan> |
| Swap slots | az webapp deployment slot swap -g <rg> -n <app> --slot <src> --target-slot production (--action preview/swap/reset) | Switch-AzWebAppSlot -SourceSlotName <src> -DestinationSlotName production -ResourceGroupName <rg> -Name <app> |
| Auto swap | az webapp deployment slot auto-swap -n <app> -g <rg> --slot <src> | Set-AzWebAppSlot ... -AutoSwapSlotName production |
| Traffic routing | az webapp traffic-routing set -g <rg> -n <app> --distribution <slot>=15 | Add-AzWebAppTrafficRouting -ResourceGroupName <rg> -WebAppName <app> -RoutingRule @{ActionHostName='<url>';ReroutePercentage='15';Name='<slot>'} |
| Delete slot | az webapp deployment slot delete --name <app> -g <rg> --slot <slot> | Remove-AzWebAppSlot -ResourceGroupName <rg> -Name <app> -Slot <slot> |
| Find IPs | nslookup <app>.azurewebsites.net; az webapp show -g <rg> -n <app> --query outboundIpAddresses -o tsv | (Get-AzWebApp -ResourceGroup <rg> -Name <app>).OutboundIpAddresses |
App Service Plans
| Task | Azure CLI | PowerShell |
|---|
| Create Linux plan | az appservice plan create -g <rg> -n <plan> --is-linux --sku B1 | - |
| Create Windows plan | az appservice plan create -g <rg> -n <plan> --sku B1 --is-linux false | New-AzAppServicePlan -ResourceGroupName <rg> -Name <plan> -Location <loc> -Tier Basic -NumberofWorkers 2 -WorkerSize Small |
| Windows container plan | az appservice plan create -g <rg> -n <plan> --hyper-v --sku P1V3 | - |
| Plan in an ASE | az appservice plan create -g <rg> -n <plan> --app-service-environment <ase> --sku I1v2 | - |
| Scale up or down | az appservice plan update -g <rg> -n <plan> --sku P1v3 | Set-AzAppServicePlan -ResourceGroupName <rg> -Name <plan> -Tier PremiumV3 -WorkerSize Small |
| Scale out or in (manual) | az appservice plan update -g <rg> -n <plan> --number-of-workers 3 | Set-AzAppServicePlan -ResourceGroupName <rg> -Name <plan> -NumberofWorkers 3 |
| Enable automatic scaling | az appservice plan update --name <plan> --resource-group <rg> --elastic-scale true --max-elastic-worker-count <n> | - |
| Always ready instances | az webapp update -g <rg> -n <app> --minimum-elastic-instance-count <n> | - |
| Prewarmed instances | az webapp update -g <rg> -n <app> --prewarmed-instance-count <n> | - |
| Per-app scaling on plan | az appservice plan update ... --set properties.perSiteScaling=true | Set-AzAppServicePlan ... -PerSiteScaling $true |
| Per-app worker limit | az webapp config set -g <rg> -n <app> --number-of-workers 5 | Set-AzWebApp ... -NumberOfWorkers 5 |
| Create autoscale setting | az monitor autoscale create -g <rg> --resource <plan-id> --min-count 2 --max-count 5 --count 3 | - |
| Scale-out rule | az monitor autoscale rule create -g <rg> --autoscale-name <name> --scale out 1 --condition "CpuPercentage > 75 avg 5m" | - |
| Scale-in rule | az monitor autoscale rule create -g <rg> --autoscale-name <name> --scale in 1 --condition "CpuPercentage < 25 avg 5m" | - |
| Disable autoscale | az monitor autoscale update -g <rg> -n <name> --enabled false | - |
| List, show, delete plan | az appservice plan list, show, delete -n <plan> -g <rg> --yes | Get-AzAppServicePlan, Remove-AzAppServicePlan |
ARM Templates & Bicep
| Task | Azure CLI | PowerShell |
|---|
| Deploy to a resource group | az deployment group create -g <rg> --template-file main.bicep --parameters storageAccountType=Standard_GRS | New-AzResourceGroupDeployment -ResourceGroupName <rg> -TemplateFile main.bicep |
| Deploy to a subscription | az deployment sub create --location <loc> --template-file main.bicep | New-AzSubscriptionDeployment |
| Deploy to a management group or tenant | az deployment mg create / az deployment tenant create (both need --location) | - |
| Complete mode | az deployment group create --mode Complete … | New-AzResourceGroupDeployment -Mode Complete … |
| Preview (what-if) | az deployment group what-if …, or --confirm-with-what-if / -c | New-AzResourceGroupDeployment -Whatif or -Confirm |
| Bicep parameter file | az deployment group create -g <rg> --parameters storage.bicepparam | - |
| ARM to Bicep | az bicep decompile --file main.json | bicep decompile main.json |
| Bicep to ARM | az bicep build --file main.bicep | bicep build main.bicep |
| Export an RG template | az group export --name <rg> | Export-AzResourceGroup -ResourceGroupName <rg> -Path ./main.json |
Availability & Scale Sets
| Task | Azure CLI | PowerShell |
|---|
| Create availability set | az vm availability-set create -n MyAvSet -g MyRG --platform-fault-domain-count 2 --platform-update-domain-count 2 | New-AzAvailabilitySet -Location EastUS -Name myAvailabilitySet -ResourceGroupName myRG -Sku aligned -PlatformFaultDomainCount 2 -PlatformUpdateDomainCount 2 |
| Create VM in the set | az vm create ... --availability-set MyAvSet | New-AzVM ... -AvailabilitySetName "myAvailabilitySet" |
| Convert set to managed disks | az vm availability-set convert -g MyRG -n MyAvSet | - |
| Zonal VM | az vm create -g myRG -n myVM --image Ubuntu2204 --generate-ssh-keys --zone 1 | - |
| Zone-spanning Flexible scale set | az vmss create -g myRG -n myScaleSet --orchestration-mode Flexible --image Ubuntu2204 --admin-username azureuser --zones 1 2 3 --generate-ssh-keys | New-AzVmss -ResourceGroupName myRG -Location EastUS -VMScaleSetName myScaleSet -OrchestrationMode Flexible |
| Manual scale | az vmss scale --new-capacity 5 --name scaleSetName --resource-group rg | Update-AzVmss -SkuCapacity 5 -ResourceGroupName rg -VMScaleSetName scaleSetName |
| Autoscale profile | az monitor autoscale create --resource-group rg --resource myScaleSet --resource-type Microsoft.Compute/virtualMachineScaleSets --name autoscale --min-count 2 --max-count 10 --count 2 | New-AzAutoscaleProfileObject, then New-AzAutoscaleSetting |
| Scale-out rule | az monitor autoscale rule create -g rg --autoscale-name autoscale --condition "Percentage CPU > 70 avg 5m" --scale out 3 | New-AzAutoscaleScaleRuleObject ... |
| Scale-in rule | az monitor autoscale rule create ... --condition "Percentage CPU < 30 avg 5m" --scale in 1 | same cmdlet with LessThan and Decrease |
| Scale-in policy | az vmss update -g rg -n vmss --scale-in-policy OldestVM | Update-AzVmss -ResourceGroupName rg -VMScaleSetName vmss -ScaleInPolicy "OldestVM" |
| Instance protection | az vmss update -g rg -n vmss --instance-id 0 --protect-from-scale-in true [--protect-from-scale-set-actions true] | Update-AzVmssVM -ResourceGroupName rg -VMScaleSetName vmss -InstanceId 0 -ProtectFromScaleIn $true |
| Automatic repairs on update | az vmss update ... --enable-automatic-repairs true --automatic-repairs-grace-period 30 --automatic-repairs-action Replace | Update-AzVmss ... -EnableAutomaticRepair $true -AutomaticRepairGracePeriod "PT40M" -AutomaticRepairAction "Restart" |
| Update instances to latest model | az vmss update-instances -g rg -n vmss --instance-ids "*" | Update-AzVmssInstance -ResourceGroupName rg -VMScaleSetName vmss -InstanceId '*' |
| Attach existing VM to Flexible scale set | az vm update -g rg -n vm --set virtualMachineScaleSet.id='<vmssId>' | Update-AzVM -ResourceGroupName rg -VM $vm -VirtualMachineScaleSetId $vmss.Id |
Containers
| Task | Azure CLI | PowerShell |
|---|
| Create registry (Premium) | az acr create -n myregistry -g myrg -l <region> --sku Premium | - |
| Change SKU | az acr update --name myContainerRegistry --sku Premium | Update-AzContainerRegistry -ResourceGroupName myResourceGroup -Name myContainerRegistry -Sku Premium |
| Sign in to registry | az acr login --name <registry> | Connect-AzContainerRegistry -Name <registry> |
| Enable admin user | az acr update -n <registry> --admin-enabled true | Update-AzContainerRegistry -Name <registry> -ResourceGroupName <rg> -EnableAdminUser |
| Cloud build | az acr build --registry <acr> --image <repo>:<tag> <context> | - |
| Add geo-replica | az acr replication create --registry <acr> --location <region> | - |
| Grant AcrPull | az role assignment create --assignee $SPID --scope <registry-id> --role acrpull | New-AzRoleAssignment -ObjectId $PrincipalId -Scope $RegistryId -RoleDefinitionName acrpull |
| ACI with restart policy | az container create -g myRG --name mycontainer --image <img> --restart-policy OnFailure | New-AzContainerGroup -ResourceGroupName myRG -Name mycontainer -Image <img> -RestartPolicy OnFailure |
| ACI DNS label and port | az container create ... --dns-name-label aci-demo --ports 80 | - |
| ACI pull via managed identity | az container create ... --acr-identity $USERID --assign-identity $USERID | - |
| ACI logs, shell, export | az container logs, az container exec --exec-command "/bin/sh", az container export | Get-AzContainerInstanceLog -ResourceGroupName myRG -ContainerGroupName name |
| Container Apps extension and provider | az extension add --name containerapp --upgrade; az provider register --namespace Microsoft.App | Install-Module -Name Az.App; Register-AzResourceProvider -ProviderNamespace Microsoft.App |
| Create environment | az containerapp env create --name <env> --resource-group <rg> --location <loc> | New-AzContainerAppManagedEnv @EnvArgs |
| Create app with ingress and scale | az containerapp create -n app -g rg --image <img> --environment env --ingress external --target-port 80 --min-replicas 1 --max-replicas 5 --scale-rule-name my-http-rule --scale-rule-http-concurrency 50 | New-AzContainerApp @AppArgs |
| Secrets and env var reference | --secrets "queue-connection-string=<value>" and --env-vars "ConnectionString=secretref:queue-connection-string" | New-AzContainerAppSecretObject -Name n -Value v |
Disk Encryption
| Task | Azure CLI | PowerShell |
|---|
| Create a vault for ADE | az keyvault create --name <kv> -g <rg> --location eastus --enabled-for-disk-encryption | New-AzKeyVault -Name <kv> -ResourceGroupName <rg> -Location EastUS -EnabledForDiskEncryption |
| Enable disk encryption on an existing vault | az keyvault update --name <kv> -g <rg> --enabled-for-disk-encryption true | Set-AzKeyVaultAccessPolicy -VaultName <kv> -ResourceGroupName <rg> -EnabledForDiskEncryption |
| Create a KEK | az keyvault key create --name myKEK --vault-name <kv> --kty RSA --size 4096 | Add-AzKeyVaultKey -Name myKEK -VaultName <kv> -Destination HSM -Size 4096 |
| Enable ADE | az vm encryption enable -g <rg> --name <vm> --disk-encryption-keyvault <kv> (add --key-encryption-key myKEK for a KEK) | Set-AzVMDiskEncryptionExtension -ResourceGroupName <rg> -VMName <vm> -DiskEncryptionKeyVaultUrl $KeyVault.VaultUri -DiskEncryptionKeyVaultId $KeyVault.ResourceId (KEK: -KeyEncryptionKeyVaultId -KeyEncryptionKeyUrl) |
| Check ADE status | az vm encryption show --name <vm> -g <rg> | Get-AzVmDiskEncryptionStatus -VMName <vm> -ResourceGroupName <rg> |
| Disable ADE | az vm encryption disable --resource-group <rg> --name <vm> --volume-type all | Disable-AzVMDiskEncryption -ResourceGroupName <rg> -VMName <vm> -VolumeType all |
| Register encryption at host | az feature register --name EncryptionAtHost --namespace Microsoft.Compute, then az feature show | Register-AzProviderFeature -FeatureName EncryptionAtHost -ProviderNamespace Microsoft.Compute, then Get-AzProviderFeature |
| VM with encryption at host | az vm create … --encryption-at-host true; existing VM: az vm update … --encryption-at-host true | Set-AzVMSecurityProfile -VM $vmConfig -EncryptionAtHost $true, then New-AzVM |
| Verify encryption at host | az vm show -g <rg> -n <vm> --query "securityProfile.encryptionAtHost" | (Get-AzVM …).SecurityProfile.EncryptionAtHost |
Moving Resources
| Task | Azure CLI | PowerShell |
|---|
| Move to another RG | az resource move --destination-group <rg> --ids <id1> <id2> | Move-AzResource -DestinationResourceGroupName <rg> -ResourceId $ids |
| Move to another subscription | Add --destination-subscription-id <sub> | Add -DestinationSubscriptionId <sub> |
| Validate a move | az resource invoke-action --action validateMoveResources --ids <source-rg-id> --request-body "{…}" | Invoke-AzResourceAction -Action validateMoveResources -ResourceId <rg-id> -Parameters @{…} |
| Compare tenants | az account show --subscription <s> --query tenantId | (Get-AzSubscription -SubscriptionName <s>).TenantId |
| Register a provider | az provider register --namespace Microsoft.Batch | Register-AzResourceProvider -ProviderNamespace Microsoft.Batch |
| Find Backup restore points | az resource list --resource-type Microsoft.Compute/restorePointCollections --query "[?starts_with(name,'AzureBackup_<vm>')].resourceGroup" | Get-AzResource -ResourceType Microsoft.Compute/restorePointCollections -Name AzureBackup_<vm>* |
| Delete restore points | az resource delete --ids $RESTOREPOINTCOL | Remove-AzResource -ResourceId … -Force |
| Disable ADE before a subscription move | az vm encryption disable -g <rg> -n <vm> --volume-type all | Disable-AzVMDiskEncryption -ResourceGroupName <rg> -VMName <vm> -VolumeType all |
Virtual Machines
| Task | Azure CLI | PowerShell |
|---|
| List resize options | az vm list-vm-resize-options -g <rg> -n <vm> | Get-AzVMSize -ResourceGroupName <rg> -VMName <vm> |
| Resize | az vm resize -g <rg> -n <vm> --size Standard_DS3_v2 | $vm.HardwareProfile.VmSize='…'; Update-AzVM -VM $vm -ResourceGroupName <rg> |
| Deallocate / start | az vm deallocate / az vm start | Stop-AzVM / Start-AzVM |
| Change disk type | az disk update --sku Premium_LRS -n <disk> -g <rg> | $disk.Sku=[…DiskSku]::new('Premium_LRS'); $disk | Update-AzDisk |
| Expand a disk | - | $disk.DiskSizeGB=1023; Update-AzDisk -ResourceGroupName <rg> -Disk $disk -DiskName $disk.Name |
| Set host caching to None on a LUN | az vm update -g <rg> -n <vm> --disk-caching 0=None | - |
| Create a VM (simple) | az vm create -n MyVm -g MyRG --image Ubuntu2204 --size Standard_D2s_v5 --generate-ssh-keys | New-AzVM -ResourceGroupName MyRG -Name MyVm -Credential (Get-Credential) -Image <img> -Size <size> -Zone 1 |
| Create a Spot VM | az vm create … --priority Spot --eviction-policy Deallocate --max-price -1 | New-AzVM … -Priority Spot -EvictionPolicy Deallocate |
| Enable Hybrid Benefit | az vm update -g MyRG -n MyVm --set licenseType=Windows_Server | $vm.LicenseType="Windows_Server"; Update-AzVM -ResourceGroupName MyRG -VM $vm (None reverts) |
| Trusted Launch | az vm create … --security-type TrustedLaunch | New-AzVM … -SecurityType TrustedLaunch |
Topic pages: App Service Configuration, App Service Plans, ARM Templates & Bicep, Availability & Scale Sets, Containers, Disk Encryption, Moving Resources, Virtual Machines.
Implement and manage storage (15–20%)
Azure Files
| Task | Azure CLI | PowerShell |
|---|
| Create a provisioned share | az storage share-rm create --resource-group <rg> --storage-account <n> --name <share> --quota 1024 --enabled-protocols SMB | New-AzRmStorageShare ... -QuotaGiB 1024 -EnabledProtocol SMB |
| Create a snapshot | az storage share snapshot --name <share> --account-name <n> | New-AzRmStorageShare ... -Snapshot |
| Delete share and snapshots | az storage share delete --name <share> --account-name <n> --delete-snapshots include | Remove-AzRmStorageShare ... -Include Snapshots |
| Enable soft delete | az storage account file-service-properties update -g <rg> --account-name <n> --enable-delete-retention true --delete-retention-days 7 | Update-AzStorageFileServiceProperty ... -EnableShareDeleteRetentionPolicy $true -ShareRetentionDays 7 |
| Restore a deleted share | az storage share-rm restore --name <share> --deleted-version <v> -g <rg> --storage-account <n> | Restore-AzRmStorageShare ... -DeletedShareVersion <v> |
| Enable Entra Kerberos | az storage account update --name <n> --resource-group <rg> --enable-files-aadkerb true | Set-AzStorageAccount ... -EnableAzureActiveDirectoryKerberosForFile $true |
| Default share permission | az storage account update --name <n> --resource-group <rg> --default-share-permission StorageFileDataSmbShareContributor | Set-AzStorageAccount ... -DefaultSharePermission StorageFileDataSmbShareContributor |
Blob Tiers & Lifecycle
| Task | Azure CLI | PowerShell |
|---|
| Create a container | az storage container create --account-name <n> --name <c> --auth-mode login | New-AzStorageContainer -Name <c> -Context $ctx -Permission Off |
| Set anonymous access level | az storage container set-permission --name <c> --account-name <n> --public-access container --auth-mode key | Set-AzStorageContainerAcl -Container <c> -Permission Container -Context $ctx |
| Change tier or rehydrate | az storage blob set-tier --account-name <n> --container-name <c> --name <b> --tier Hot --rehydrate-priority Standard --auth-mode login | $blob.BlobClient.SetAccessTier("Hot", $null, "Standard") |
| Rehydrate by copy | az storage blob copy start --source-container <sc> --source-blob <sb> --destination-container <dc> --destination-blob <db> --account-name <n> --tier hot --rehydrate-priority standard --auth-mode login | Start-AzStorageBlobCopy ... -StandardBlobTier Hot -RehydratePriority Standard |
| Create a lifecycle policy | az storage account management-policy create --account-name <n> --policy @policy.json --resource-group <rg> | Set-AzStorageAccountManagementPolicy -ResourceGroupName <rg> -StorageAccountName <n> -Rule $rule1 |
| Enable last access tracking | az storage account blob-service-properties update --resource-group <rg> --account-name <n> --enable-last-access-tracking true | Enable-AzStorageBlobLastAccessTimeTracking -ResourceGroupName <rg> -StorageAccountName <n> -PassThru |
Blob Versioning & Soft Delete
| Task | Azure CLI | PowerShell |
|---|
| Enable versioning | az storage account blob-service-properties update --resource-group <rg> --account-name <n> --enable-versioning true | Update-AzStorageBlobServiceProperty -ResourceGroupName <rg> -StorageAccountName <n> -IsVersioningEnabled $true |
| List versions | az storage blob list --container-name <c> --account-name <n> --include v --auth-mode login | Get-AzStorageBlob -Container <c> -IncludeVersion -Context $ctx |
| Enable blob soft delete | az storage account blob-service-properties update ... --enable-delete-retention true --delete-retention-days 14 | Enable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName <rg> -StorageAccountName <n> -RetentionDays 14 |
| Enable container soft delete | az storage account blob-service-properties update --enable-container-delete-retention true --container-delete-retention-days 7 --account-name <n> --resource-group <rg> | Enable-AzStorageContainerDeleteRetentionPolicy -ResourceGroupName <rg> -StorageAccountName <n> -RetentionDays 7 |
| Enable change feed and versioning | ... --enable-change-feed true --enable-versioning true | Update-AzStorageBlobServiceProperty ... -EnableChangeFeed $true -IsVersioningEnabled $true |
| Enable PITR | ... --enable-restore-policy true --restore-days 7 | Enable-AzStorageBlobRestorePolicy -ResourceGroupName <rg> -StorageAccountName <n> -RestoreDays 7 |
| Restore all containers | az storage blob restore --resource-group <rg> --account-name <n> --time-to-restore 2026-11-12T06:31:22Z --no-wait | Restore-AzStorageBlobRange -ResourceGroupName <rg> -StorageAccountName <n> -TimeToRestore (Get-Date).ToUniversalTime().AddHours(-12) |
| Restore ranges | az storage blob restore ... --blob-range container3/d container3/g | New-AzStorageBlobRangeToRestore -StartRange container1 -EndRange container2, then Restore-AzStorageBlobRange -BlobRestoreRange $range ... |
| Check restore status | az storage account show --name <n> --resource-group <rg> --expand blobRestoreStatus --query blobRestoreStatus.status | $restoreOperation.Status |
Storage Encryption
| Task | Azure CLI | PowerShell |
|---|
| Create a vault with purge protection and RBAC | az keyvault create --name <kv> --resource-group <rg> --location <loc> --enable-purge-protection --enable-rbac-authorization | New-AzKeyVault -Name <kv> -ResourceGroupName <rg> -Location <loc> -EnablePurgeProtection -EnableRbacAuthorization |
| Create a key | az keyvault key create --name <key> --vault-name <kv> | Add-AzKeyVaultKey -VaultName <kv> -Name <key> -Destination Software |
| Assign a system identity to the account | az storage account update --name <n> --resource-group <rg> --assign-identity | Set-AzStorageAccount -ResourceGroupName <rg> -Name <n> -AssignIdentity |
| Enable CMK (automatic version) | az storage account update ... --encryption-key-name <key> --encryption-key-version "" --encryption-key-source Microsoft.Keyvault --encryption-key-vault <vaultUri> | Set-AzStorageAccount ... -KeyvaultEncryption -KeyName <key> -KeyVersion "" -KeyVaultUri <uri> |
| Back to Microsoft-managed keys | az storage account update ... --encryption-key-source Microsoft.Storage | Set-AzStorageAccount ... -StorageEncryption |
| Revoke (disable the key) | az keyvault key set-attributes --vault-name <kv> --name <key> --enabled false | Update-AzKeyVaultKey -VaultName <kv> -Name <key> -Enable $false |
| Create an account with infrastructure encryption | az storage account create ... --require-infrastructure-encryption | New-AzStorageAccount ... -RequireInfrastructureEncryption |
| Create an encryption scope (Microsoft key) | az storage account encryption-scope create --resource-group <rg> --account-name <n> --name <scope> --key-source Microsoft.Storage | New-AzStorageEncryptionScope -ResourceGroupName <rg> -StorageAccountName <n> -EncryptionScopeName <scope> -StorageEncryption |
| Create an encryption scope (CMK) | ... --key-source Microsoft.KeyVault --key-uri <uri> | New-AzStorageEncryptionScope ... -KeyUri <uri> -KeyvaultEncryption |
| Container with default scope, no override | az storage container create --account-name <n> --name <c> --default-encryption-scope <scope> --prevent-encryption-scope-override true --auth-mode login | New-AzStorageContainer -Name <c> -Context $ctx -DefaultEncryptionScope <scope> -PreventEncryptionScopeOverride $true |
| Upload a blob with a scope | az storage blob upload ... --encryption-scope <scope> | Set-AzStorageBlobContent ... -EncryptionScope <scope> |
| Disable a scope | az storage account encryption-scope update ... --state Disabled | Update-AzStorageEncryptionScope ... -State disabled |
Object Replication
| Task | Azure CLI | PowerShell |
|---|
| Enable versioning and change feed (source) | az storage account blob-service-properties update --resource-group <rg> --account-name <src> --enable-versioning --enable-change-feed | Update-AzStorageBlobServiceProperty -ResourceGroupName <rg> -StorageAccountName <src> -EnableChangeFeed $true -IsVersioningEnabled $true |
| Enable versioning (destination) | az storage account blob-service-properties update --resource-group <rg> --account-name <dest> --enable-versioning | Update-AzStorageBlobServiceProperty ... -IsVersioningEnabled $true |
| Create the policy on the destination | az storage account or-policy create --account-name <dest> --resource-group <rg> --source-account <src> --destination-account <dest> --source-container <c1> --destination-container <c2> --min-creation-time '2021-09-01T00:00:00Z' --prefix-match a | Set-AzStorageObjectReplicationPolicy -ResourceGroupName <rg> -StorageAccountName <dest> -PolicyId default -SourceAccount <src> -Rule $rule1,$rule2 |
| Add a rule | az storage account or-policy rule add --account-name <dest> --resource-group <rg> --source-container <c> --destination-container <c> --policy-id <id> --prefix-match b | New-AzStorageObjectReplicationPolicyRule |
| Apply the policy to the source | az storage account or-policy show --account-name <dest> --policy-id <id> | az storage account or-policy create --account-name <src> --policy "@-" | Set-AzStorageObjectReplicationPolicy -ResourceGroupName <rg> -StorageAccountName <src> -InputObject $destPolicy |
| Check a blob's status | az storage blob show ... --query 'objectReplicationSourceProperties[].rules[].status' | $blob.BlobProperties.ObjectReplicationSourceProperties[0].Rules[0].ReplicationStatus |
| Delete a policy | az storage account or-policy delete --policy-id <id> --account-name <src|dest> --resource-group <rg> | Remove-AzStorageObjectReplicationPolicy -ResourceGroupName <rg> -StorageAccountName <acct> -PolicyId <id> |
Storage Redundancy & Failover
| Task | Azure CLI | PowerShell |
|---|
| Add or remove geo-replication or read access (SKU change) | az storage account update --sku | - |
| Add or remove zone redundancy (conversion) | az storage account migration start | - |
| Customer-managed failover | az storage account failover --failover-type planned|unplanned | - |
| Check Last Sync Time before a failover | az storage account show --expand geoReplicationStats | - |
Storage Access
| Task | Azure CLI | PowerShell |
|---|
| List keys | az storage account keys list --resource-group <rg> --account-name <n> | Get-AzStorageAccountKey -ResourceGroupName <rg> -Name <n> |
| Regenerate a key | az storage account keys renew --resource-group <rg> --account-name <n> --key primary | New-AzStorageAccountKey -ResourceGroupName <rg> -Name <n> -KeyName key1 |
| Disallow Shared Key | az storage account update --name <n> --resource-group <rg> --allow-shared-key-access false | Set-AzStorageAccount -ResourceGroupName <rg> -AccountName <n> -AllowSharedKeyAccess $false |
| User delegation SAS (blob) | az storage blob generate-sas --account-name <n> --container-name <c> --name <b> --permissions acdrw --expiry <dt> --auth-mode login --as-user --full-uri | - |
| Revoke user delegation keys | az storage account revoke-delegation-keys --name <n> --resource-group <rg> | - |
| Stored access policy | az storage container policy create --container-name <c> --name <p> --permissions <rwdl> --start <dt> --expiry <dt> --account-name <n> | - |
| SAS expiration policy | az storage account update --name <n> --resource-group <rg> --sas-exp 1.12:05:06 --sas-expiration-action Block | Set-AzStorageAccount ... -SasExpirationPeriod 1.12:05:06 -SasExpirationAction Block |
| Default action Deny | az storage account update -g <rg> -n <n> --default-action Deny | Update-AzStorageAccountNetworkRuleSet -ResourceGroupName <rg> -Name <n> -DefaultAction Deny |
| Service endpoint on a subnet | az network vnet subnet update -g <rg> --vnet-name <v> --name <s> --service-endpoints "Microsoft.Storage.Global" | Set-AzVirtualNetworkSubnetConfig ... -ServiceEndpoint "Microsoft.Storage.Global", then Set-AzVirtualNetwork |
| Add a VNet rule | az storage account network-rule add -g <rg> --account-name <n> --subnet <subnetId> | Add-AzStorageAccountNetworkRule -ResourceGroupName <rg> -Name <n> -VirtualNetworkResourceId $subnet.Id |
| Add an IP rule | az storage account network-rule add -g <rg> --account-name <n> --ip-address "16.17.18.0/24" | Add-AzStorageAccountNetworkRule -ResourceGroupName <rg> -AccountName <n> -IPAddressOrRange "16.17.18.0/24" |
| Set exceptions | az storage account update -g <rg> -n <n> --bypass Logging Metrics AzureServices | Update-AzStorageAccountNetworkRuleSet -ResourceGroupName <rg> -Name <n> -Bypass AzureServices,Metrics,Logging |
| Block anonymous access | az storage account update ... --allow-blob-public-access false | -AllowBlobPublicAccess $false |
| Container access level | az storage container set-permission --name <c> --account-name <n> --public-access container|blob|off --auth-mode key | Set-AzStorageContainerAcl -Container <c> -Permission Container -Context $ctx |
Storage Accounts
| Task | Azure CLI | PowerShell |
|---|
| Create a GPv2 RA-GRS account | az storage account create --name <n> --resource-group <rg> --location eastus --sku Standard_RAGRS --kind StorageV2 --min-tls-version TLS1_2 --allow-blob-public-access false | New-AzStorageAccount -ResourceGroupName $rg -Name $n -Location $loc -SkuName Standard_RAGRS -Kind StorageV2 |
| Enable hierarchical namespace | --enable-hierarchical-namespace true on create | -EnableHierarchicalNamespace $True on New-AzStorageAccount |
| Upgrade GPv1 to GPv2 | az storage account update -g <rg> -n <n> --set kind=StorageV2 | Set-AzStorageAccount -ResourceGroupName <rg> -AccountName <n> -UpgradeToStorageV2 |
AzCopy & Storage Explorer (AzCopy v10)
AzCopy is its own tool, not the Azure CLI or PowerShell.
| Task | AzCopy command |
|---|
| Sign in with Microsoft Entra ID | azcopy login |
| Create a container | azcopy make 'https://<acct>.blob.core.windows.net/<container>' |
| Upload a folder with subfolders | azcopy copy 'C:\myDirectory' '<container-url>' --recursive |
| Upload folder contents only | azcopy copy 'C:\myDirectory\*' '<container-url>/<dir>' |
| Copy a container between accounts | azcopy copy '<src-container-url>' '<dst-container-url>' --recursive |
| Incremental update | azcopy sync '<local-path>' '<container-url>' --recursive |
| Mirror deletes too | azcopy sync ... --delete-destination=true |
| Upload straight to Archive | azcopy copy ... --block-blob-tier=Archive |
| Resume an interrupted job | azcopy jobs list, then azcopy jobs resume <job-id> |
Topic pages: Azure Files, Blob Tiers & Lifecycle, Blob Versioning & Soft Delete, Storage Encryption, Object Replication, Storage Redundancy & Failover, Storage Access, Storage Accounts, AzCopy & Storage Explorer.
Implement and manage virtual networking (15–20%)
Azure DNS
| Task | Azure CLI | PowerShell |
|---|
| Create a public zone | az network dns zone create -g MyResourceGroup -n contoso.xyz | - |
| Add an A record | az network dns record-set a add-record -g MyResourceGroup -z contoso.xyz -n www -a 10.10.10.10 | - |
| List records | az network dns record-set list -g MyResourceGroup -z contoso.xyz | - |
| Show name servers | az network dns record-set ns show --resource-group MyResourceGroup --zone-name contoso.xyz --name @ | - |
| Test before delegation | nslookup www.contoso.xyz <azure name server> | - |
| Create a private zone | az network private-dns zone create -g test-rg --name "privatelink.azurewebsites.net" | - |
| Link a vnet (true for autoregistration) | az network private-dns link vnet create -g rg --zone-name <zone> --name dns-link --virtual-network vnet-1 --registration-enabled false | - |
| Assign DNS Zone Contributor | az role assignment create --assignee "<user>" --role "DNS Zone Contributor" --resource-group "<rg>" | - |
| PowerShell A record set | - | $Records = @(); $Records += New-AzDnsRecordConfig -IPv4Address 1.2.3.4; New-AzDnsRecordSet -Name "www" -RecordType A -ResourceGroupName "MyResourceGroup" -TTL 3600 -ZoneName "myzone.com" -DnsRecords $Records |
| PowerShell alias record set | - | New-AzDnsRecordSet ... -TargetResourceId <resource ID>. for a Traffic Manager linked record set use -TrafficManagerProfileId instead |
Azure Bastion
| Task | Azure CLI | PowerShell |
|---|
| Create the subnet | az network vnet subnet create --name AzureBastionSubnet --resource-group TestRG1 --vnet-name VNet1 --address-prefix 10.1.1.0/26 | - |
| Create the public IP | az network public-ip create --resource-group TestRG1 --name VNet1-ip --sku Standard --location eastus | - |
| Create Bastion (CLI) | az network bastion create --name VNet1-bastion --public-ip-address VNet1-ip --resource-group TestRG1 --vnet-name VNet1 --location eastus --sku Basic. In the CLI, omitting --sku gives Standard. --scale-units defaults to 2. | - |
| Create Bastion (PowerShell) | - | New-AzBastion -ResourceGroupName "BastionPowershellTest" -Name "testBastion2" -PublicIpAddressRgName ... -PublicIpAddressName ... -VirtualNetworkRgName ... -VirtualNetworkName ... -Sku "Standard" -ScaleUnit 3. In PowerShell, -Sku defaults to Basic. |
| Developer SKU | az network bastion create --name MyBastion --resource-group MyResourceGroup --sku Developer --vnet-name MyVnet (no subnet or public IP needed) | - |
| Turn on native client | az network bastion update --name MyBastionHost --resource-group MyResourceGroup --enable-tunneling | - |
| Native SSH | az network bastion ssh --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --auth-type password --username xyz (--auth-type is required) | - |
| Native RDP | az network bastion rdp --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId | - |
| Tunnel | az network bastion tunnel --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --resource-port 22 --port 50022 | - |
Service & Private Endpoints
| Task | Azure CLI | PowerShell |
|---|
| Subnet with service endpoint | az network vnet subnet create --vnet-name vnet-1 -g test-rg -n subnet-private --address-prefix 10.0.1.0/24 --service-endpoints Microsoft.Storage | - |
| Storage default action | az storage account update --name $acct -g test-rg --default-action Deny | - |
| Allow the subnet on storage | az storage account network-rule add -g test-rg --account-name $acct --vnet-name vnet-1 --subnet subnet-private | - |
| Create a private endpoint | az network private-endpoint create --connection-name connection-1 --name private-endpoint -g test-rg --subnet subnet-1 --vnet-name vnet-1 --private-connection-resource-id $id --group-id sites | - |
| Private DNS zone | az network private-dns zone create -g test-rg --name "privatelink.azurewebsites.net" | - |
| Link zone to vnet | az network private-dns link vnet create -g test-rg --zone-name "privatelink.azurewebsites.net" --name dns-link --virtual-network vnet-1 --registration-enabled false | - |
| DNS zone group | az network private-endpoint dns-zone-group create -g test-rg --endpoint-name private-endpoint --name zone-group --private-dns-zone "privatelink.azurewebsites.net" --zone-name webapp | - |
| PowerShell: service endpoint on subnet | - | New-AzVirtualNetworkSubnetConfig ... -ServiceEndpoint "Microsoft.Storage" |
| PowerShell: storage firewall | - | Update-AzStorageAccountNetworkRuleSet -DefaultAction Deny and Add-AzStorageAccountNetworkRule |
| PowerShell: private endpoint | - | New-AzPrivateLinkServiceConnection then New-AzPrivateEndpoint (mandatory: -Name, -ResourceGroupName, -Location, -Subnet, -PrivateLinkServiceConnection). -ByManualRequest asks for manual approval |
Load Balancer
| Task | Azure CLI | PowerShell |
|---|
| Create a Standard public load balancer | az network lb create -g rg -n load-balancer --sku Standard --public-ip-address lb-frontend-ip --frontend-ip-name lb-frontend --backend-pool-name lb-backend-pool | - |
| Create an internal load balancer | az network lb create -g rg -n load-balancer --sku Standard --vnet-name lb-vnet --subnet backend-subnet --backend-pool-name lb-backend-pool --frontend-ip-name lb-frontend (no public IP, so the frontend takes a private IP from the subnet) | - |
| Health probe | az network lb probe create -g rg --lb-name load-balancer -n lb-health-probe --protocol tcp --port 80 | - |
| Load-balancing rule | az network lb rule create -g rg --lb-name load-balancer -n lb-HTTP-rule --protocol tcp --frontend-port 80 --backend-port 80 --frontend-ip-name lb-frontend --backend-pool-name lb-backend-pool --probe-name lb-health-probe --disable-outbound-snat true --idle-timeout 15 --enable-tcp-reset true | - |
| Add a NIC to the backend pool | az network nic ip-config address-pool add --address-pool lb-backend-pool --ip-config-name ipconfig1 --nic-name lb-VM1-nic -g rg --lb-name load-balancer | - |
| NSG allow rule | az network nsg rule create -g rg --nsg-name lb-nsg -n lb-nsg-rule --protocol '*' --direction inbound --destination-port-range 80 --access allow --priority 200 | - |
| NAT gateway on the subnet | az network vnet subnet update --nat-gateway lb-nat-gateway (after az network nat gateway create) | - |
| PowerShell building blocks | - | New-AzLoadBalancerFrontendIpConfig, New-AzLoadBalancerBackendAddressPoolConfig, New-AzLoadBalancerProbeConfig, New-AzLoadBalancerRuleConfig (-EnableFloatingIP, -LoadDistribution SourceIP, -DisableOutboundSNAT), then New-AzLoadBalancer -Sku Standard |
Network Troubleshooting
| Task | Azure CLI | PowerShell |
|---|
| IP flow verify | az network watcher test-ip-flow -g MyResourceGroup --direction Outbound --protocol TCP --local 10.0.0.4:* --remote 10.1.0.4:80 --vm MyVm | not covered here |
| Next hop | az network watcher show-next-hop -g MyResourceGroup --vm MyVm --source-ip 10.0.0.4 --dest-ip 10.1.0.4 | Get-AzNetworkWatcherNextHop |
| Effective security rules | az network nic list-effective-nsg --name vm-nic --resource-group test-rg | Get-AzEffectiveNetworkSecurityGroup -NetworkInterfaceName vm-nic -ResourceGroupName test-rg |
| Effective routes | az network nic show-effective-route-table | Get-AzEffectiveRouteTable |
| Connectivity test (preview) | az network watcher test-connectivity -g MyResourceGroup --source-resource MyVmName1 --dest-resource MyVmName2 --dest-port 80 | not covered here |
| Enable Network Watcher in a region | az network watcher configure -g NetworkWatcherRG -l westus --enabled true | not covered here |
NSGs & ASGs
| Task | Azure CLI | PowerShell |
|---|
| Create NSG | az network nsg create -g myResourceGroup -n myNSG | New-AzNetworkSecurityGroup -Name myNSG -ResourceGroupName myResourceGroup -Location eastus |
| Create rule | az network nsg rule create -g myRG --nsg-name myNSG -n RDP-rule --priority 300 --destination-port-ranges 3389 --protocol Tcp --description "Allow RDP" | Add-AzNetworkSecurityRuleConfig ..., then Set-AzNetworkSecurityGroup |
| Update rule | az network nsg rule update ... --priority 200 | Set-AzNetworkSecurityRuleConfig, then Set-AzNetworkSecurityGroup |
| Associate to a subnet | az network vnet subnet update -g myRG --vnet-name myVNet -n mySubnet --network-security-group myNSG | Set-AzVirtualNetworkSubnetConfig -NetworkSecurityGroup, then Set-AzVirtualNetwork |
| Create ASG | az network asg create -g myRG -n myASG -l eastus | New-AzApplicationSecurityGroup |
| Effective security rules | az network nic list-effective-nsg --name vm-nic -g test-rg | Get-AzEffectiveNetworkSecurityGroup -NetworkInterfaceName vm-nic -ResourceGroupName test-rg |
VNet Peering
| Task | Azure CLI | PowerShell |
|---|
| Create one direction (run for each direction) | az network vnet peering create -n vnet-1-to-vnet-2 --vnet-name vnet-1 --remote-vnet vnet-2 -g test-rg --allow-vnet-access --allow-forwarded-traffic | Add-AzVirtualNetworkPeering -Name vnet-1-to-vnet-2 -VirtualNetwork $vnet1 -RemoteVirtualNetworkId $vnet2.Id |
| List / show | az network vnet peering list, az network vnet peering show | Get-AzVirtualNetworkPeering |
| Change a setting | az network vnet peering update ... --set allowForwardedTraffic=false | Set $peering.AllowForwardedTraffic, then Set-AzVirtualNetworkPeering |
| Sync after an address space change | az network vnet peering sync -g MyResourceGroup -n MyVnet1ToMyVnet2 --vnet-name MyVnet1 | Sync from the portal or PowerShell |
| Delete | az network vnet peering delete | Remove-AzVirtualNetworkPeering |
Public IP Addresses
| Task | Azure CLI | PowerShell |
|---|
| Standard zone-redundant IPv4 (CLI) | az network public-ip create -g rg -n myStandardPublicIP --version IPv4 --sku Standard --zone 1 2 3 | - |
| Zonal IP (CLI) | az network public-ip create ... --zone 2 | - |
| IPv6 (CLI) | az network public-ip create ... --version IPv6 | - |
| Global tier (CLI) | az network public-ip create ... --tier global --sku Standard | - |
| Routing preference Internet (CLI) | az network public-ip create ... --ip-tags 'RoutingPreference=Internet' | - |
| Show the address (CLI) | az network public-ip show -g rg -n lb-frontend-ip --query ipAddress -o tsv | - |
| Static IP with a DNS label (PowerShell) | - | New-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -AllocationMethod Static -DomainNameLabel $dnsPrefix -Location $location |
| Standard IP from a prefix (PowerShell) | - | New-AzPublicIpAddress ... -AllocationMethod Static -PublicIpPrefix $publicIpPrefix -Sku Standard |
| Global tier (PowerShell) | - | New-AzPublicIpAddress ... -AllocationMethod Static -Sku Standard -Tier Global |
Routing & UDRs
| Task | Azure CLI | PowerShell |
|---|
| Create route table | az network route-table create | New-AzRouteTable |
| Add route | az network route-table route create --route-table-name MyRouteTable --name StorageRoute --address-prefix Storage --next-hop-type VirtualAppliance --next-hop-ip-address 10.0.100.4 | New-AzRouteConfig -Name StorageRoute -AddressPrefix Storage -NextHopType VirtualAppliance -NextHopIpAddress 10.0.100.4, add to the table, then Set-AzRouteTable |
| Associate or dissociate | az network vnet subnet update (with the route table) | Set-AzVirtualNetworkSubnetConfig |
| Effective routes | az network nic show-effective-route-table | Get-AzEffectiveRouteTable |
| Next hop test | az network watcher show-next-hop | Get-AzNetworkWatcherNextHop |
| Delete route table | az network route-table delete | Remove-AzRouteTable |
VNets & Subnets
| Task | Azure CLI | PowerShell |
|---|
| Create vnet | az network vnet create -g myRG -n myVNet (default space 10.0.0.0/16) | New-AzVirtualNetwork -ResourceGroupName myRG -Name myVNet -Location eastus -AddressPrefix 10.0.0.0/16 |
| Create vnet with first subnet | az network vnet create ... --address-prefix 10.0.0.0/16 --subnet-name subnet-1 --subnet-prefix 10.0.0.0/24 | New-AzVirtualNetworkSubnetConfig, then New-AzVirtualNetwork -Subnet |
| Replace address space | az network vnet update -g myRG -n myVNet --address-prefixes 10.1.0.0/16 (replaces any previous ranges) | Edit $vnet.AddressSpace.AddressPrefixes, then Set-AzVirtualNetwork |
| Set custom DNS | az network vnet update ... --dns-servers 10.0.0.10 | $vnet.DhcpOptions.DnsServers.Add("10.0.0.10"), then Set-AzVirtualNetwork |
| Delegate a subnet | az network vnet subnet update -g rg --vnet-name vnet-1 -n subnet-1 --delegations Microsoft.Sql/managedInstances | Add-AzDelegation, then Set-AzVirtualNetwork |
| Remove delegation | az network vnet subnet update ... --remove delegations | Remove-AzDelegation, then Set-AzVirtualNetwork |
| Make subnet private | az network vnet subnet update --resource-group rgname --name subnetname --vnet-name vnetname --default-outbound false | Set $subnet.DefaultOutboundAccess = $false, then Set-AzVirtualNetwork |
| Delete vnet | az network vnet delete | Remove-AzVirtualNetwork |
Topic pages: Azure DNS, Azure Bastion, Service & Private Endpoints, Load Balancer, Network Troubleshooting, NSGs & ASGs, VNet Peering, Public IP Addresses, Routing & UDRs, VNets & Subnets.
Monitor and maintain Azure resources (10–15%)
Alerts & Action Groups
| Task | Azure CLI | PowerShell |
|---|
| Create an alert processing rule | az extension add --name alertsmanagement, then az monitor alert-processing-rule create --name N --rule-type AddActionGroups --scopes /subscriptions/SUB1 --action-groups <id> --resource-group RG | Set-AzAlertProcessingRule -Name N -AlertProcessingRuleType AddActionGroups -Scope /subscriptions/SUB1 -ActionGroupId <id> -ResourceGroupName RG |
| List, show, update, delete processing rules | az monitor alert-processing-rule list|show|update|delete | Get-, Update-, Remove-AzAlertProcessingRule |
| Create a metric alert | az monitor metrics alert create --name N --resource-group RG --scopes <id> --condition "avg Percentage CPU > 90". Required: --condition, --name, --resource-group, --scopes. Optional include --action, --auto-mitigate, --description. The condition string is an illustration | Not covered on the page |
| Create an action group | az monitor action-group create --name N --resource-group RG plus receiver options such as --action, --arm-role-receivers, --automation-runbook-receivers, --azure-app-push-receivers, --azure-function-receivers | Not covered on the page |
| Create an action group as code | ARM resource Microsoft.Insights/actionGroups | Same template |
Azure Monitor
| Task | Azure CLI | PowerShell |
|---|
| Create a resource diagnostic setting | az monitor diagnostic-settings create --name N --resource <id> --logs '[{"category":"AuditEvent","enabled":true}]' --metrics '[{"category":"AllMetrics","enabled":true}]' --workspace <id> | New-AzDiagnosticSetting -Name N -ResourceId <id> -WorkspaceId <id> -Log $log -Metric $metric |
| Export the activity log | az monitor diagnostic-settings subscription create (or update) | Not supported with New-AzDiagnosticSetting; use an ARM template |
| Use resource-specific tables | Add --export-to-resource-specific true | Not covered on the page |
| Install Azure Monitor Agent on a Windows VM | az vm extension set --name AzureMonitorWindowsAgent --publisher Microsoft.Azure.Monitor --vm-name VM --resource-group RG | Not covered on the page |
| Associate a DCR with a VM | az monitor data-collection rule association create --name A --rule-id <dcr> --resource <vm id> | New-AzDataCollectionRuleAssociation -AssociationName A -ResourceUri <vm id> -DataCollectionRuleId <dcr> |
| Read metrics | az monitor metrics command group | Az.Monitor module cmdlets |
Backup & Restore
| Task | Azure CLI | PowerShell |
|---|
| Enable backup | az backup protection enable-for-vm --policy-name P --resource-group RG --vault-name V --vm VM (pass the full ARM ID for a VM in another subscription) | Enable-AzRecoveryServicesBackupProtection -Policy $Pol -Name VM -ResourceGroupName RG -VaultId $id |
| Restore disks | az backup restore restore-disks --container-name C --item-name I --resource-group RG --rp-name RP --storage-account SA --vault-name V | — |
| Stop protection and delete data | az backup protection disable ... --delete-backup-data true | Disable-AzRecoveryServicesBackupProtection -Item $item -RemoveRecoveryPoints |
| Instant Restore retention | — | $pol.SnapshotRetentionInDays=5 then Set-AzRecoveryServicesBackupProtectionPolicy -policy $pol |
| Diagnostics for reports | az monitor diagnostic-settings create on the vault | New-AzDiagnosticSetting |
Backup Vaults
| Task | Azure CLI | PowerShell |
|---|
| Delete vault | az backup vault delete --name V --resource-group RG --force --yes (VM backups only) | Remove-AzRecoveryServicesVault -Vault $vault |
| Stop protection and delete data | az backup protection disable --container-name C --item-name I --delete-backup-data true --vault-name V --resource-group RG --yes | Disable-AzRecoveryServicesBackupProtection -Item $item -RemoveRecoveryPoints -Force |
| Unregister MARS or MABS | — | Unregister-AzRecoveryServicesBackupContainer, Unregister-AzRecoveryServicesBackupManagementServer |
Insights
| Task | Azure CLI | PowerShell |
|---|
| Install Azure Monitor Agent (Windows VM) | az vm extension set --name AzureMonitorWindowsAgent --publisher Microsoft.Azure.Monitor | See the install page |
| Associate a DCR | az monitor data-collection rule association create | New-AzDataCollectionRuleAssociation |
Network Watcher
| Task | Azure CLI | PowerShell |
|---|
| IP flow verify | az network watcher test-ip-flow -g MyResourceGroup --direction Outbound --protocol TCP --local 10.0.0.4:* --remote 10.1.0.4:80 --vm MyVm | Test-AzNetworkWatcherIPFlow |
| Next hop | az network watcher show-next-hop --dest-ip <ip> --source-ip <ip> --vm <vm> | Get-AzNetworkWatcherNextHop -NetworkWatcher $nw -TargetVirtualMachineId $VM.Id -SourceIPAddress <ip> -DestinationIPAddress <ip> |
| Create a connection monitor | Not named on the Connection Monitor overview page | PowerShell is supported, as are the portal and ARMClient |
| Stateful inbound TCP flow timeout | Not covered on the page | $vnet.FlowTimeoutInMinutes = 4; $vnet | Set-AzVirtualNetwork |
Topic pages: Alerts & Action Groups, Azure Monitor, Backup & Restore, Backup Vaults, Insights, Network Watcher.
Pages with no command table
These topic pages have no CLI or PowerShell table, so nothing from them is repeated here: Site Recovery.