Home › Studies › AZ-104 › CLI & PowerShell Commands

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 CLIPowerShell
Shapeaz <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 VMaz vm create -n MyVm -g MyRG --image Ubuntu2204 --size Standard_D2s_v5 --generate-ssh-keysNew-AzVM -ResourceGroupName MyRG -Name MyVm -Credential (Get-Credential) -Image <img> -Size <size> -Zone 1
Deploy to a resource groupaz deployment group create -g <rg> --template-file main.bicep --parameters storageAccountType=Standard_GRSNew-AzResourceGroupDeployment -ResourceGroupName <rg> -TemplateFile main.bicep
Deallocate / start a VMaz vm deallocate / az vm startStop-AzVM / Start-AzVM
Change a SKUaz acr update --name myContainerRegistry --sku PremiumUpdate-AzContainerRegistry -ResourceGroupName myResourceGroup -Name myContainerRegistry -Sku Premium

Topic pages: Virtual Machines, ARM Templates & Bicep, Containers, Azure Policy, Azure Bastion.

Manage Azure identities and governance (20–25%)

Azure Policy

TaskAzure CLIPowerShell
Assign with a managed identityaz policy assignment create ... --mi-system-assigned --location <loc>New-AzPolicyAssignment ... -IdentityType SystemAssigned -Location <loc>
Create a remediation taskaz policy remediation create --name myRemediation --policy-assignment <id>Start-AzPolicyRemediation -Name myRemediation -PolicyAssignmentId <id>
Get a definitionaz policy definition showGet-AzPolicyDefinition

Cost Management

TaskAzure CLIPowerShell
Create a budget on a resource groupaz 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 receiveraz 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

TaskAzure CLIPowerShell
Add a user to the Guest Inviter role-New-MgDirectoryRoleMemberByRef -DirectoryRoleId $role.Id -BodyParameter $DirObject

Licensing

TaskAzure CLIPowerShell
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

TaskAzure CLIPowerShell
Lock a resource groupaz lock create --name LockGroup --lock-type CanNotDelete --resource-group exampleresourcegroupNew-AzResourceLock -LockName LockGroup -LockLevel CanNotDelete -ResourceGroupName exampleresourcegroup
Lock a resourceaz lock create --name LockSite --lock-type CanNotDelete --resource-group <rg> --resource-name <n> --resource-type Microsoft.Web/sitesNew-AzResourceLock -LockLevel CanNotDelete -LockName LockSite -ResourceName <n> -ResourceType Microsoft.Web/sites -ResourceGroupName <rg>
List locksaz lock listGet-AzResourceLock
Delete a lockaz lock delete --ids <lockId>Remove-AzResourceLock -LockId <id>
Set tags, replacing the whole setaz tag create --resource-id $resource --tags Dept=Finance Status=NormalNew-AzTag -ResourceId $resource.id -Tag $tags
Merge: add new names and update existing values, keep the restaz tag update --resource-id <id> --operation Merge --tags key1=value1Update-AzTag -ResourceId <id> -Tag $tags -Operation Merge
Replace the whole setaz tag update --resource-id <id> --operation Replace --tags key1=value1Update-AzTag -ResourceId <id> -Tag $tags -Operation Replace
Delete only the named tagsaz tag update --resource-id $resource --operation Delete --tags Project=ECommerce Team=WebUpdate-AzTag -ResourceId $resource.id -Tag $removeTags -Operation Delete
Remove all tagsaz tag delete --resource-id $resourceRemove-AzTag -ResourceId <id>
List tagsaz tag list --resource-id $resourceGet-AzTag -ResourceId $resource.id
Find by tagaz resource list --tag CostCenter=00123 --query [].name(Get-AzResource -Tag @{ "CostCenter"="00123"}).Name

Azure RBAC

TaskAzure CLIPowerShell
Assign a role by object IDaz role assignment create --assignee-object-id <id> --role "Contributor" --scope <scope>New-AzRoleAssignment (with -ObjectType for new principals)
List assignments at rootaz role assignment list --role "User Access Administrator" --scope "/"Get-AzRoleAssignment
Remove an assignmentaz role assignment delete --assignee <upn> --role "User Access Administrator" --scope "/"Remove-AzRoleAssignment -SignInName <upn> -RoleDefinitionName "User Access Administrator" -Scope "/"
Elevate accessaz rest --method post --url "/providers/Microsoft.Authorization/elevateAccess?api-version=2016-07-01"Use the portal or REST
List deny assignmentsNot verifiedGet-AzDenyAssignment
Find a role IDaz role definition list --name "Contributor"n/a

Self-Service Password Reset

TaskAzure CLIPowerShell
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

TaskAzure CLIPowerShell
Createaz group create --name demoResourceGroup --location westusNew-AzResourceGroup -Name exampleGroup -Location westus
Deleteaz group delete --name exampleGroupRemove-AzResourceGroup -Name exampleGroup
Listaz group listGet-AzResourceGroup
Showaz group show --name exampleGroupGet-AzResourceGroup -Name exampleGroup
Moveaz 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 movingaz resource invoke-action --action validateMoveResources --ids <rgId> --request-body <json>Invoke-AzResourceAction -Action validateMoveResources -ResourceId <rgId> -Parameters @{...}
Check tenantaz account show --subscription <s> --query tenantId(Get-AzSubscription -SubscriptionName <s>).TenantId
Register a provideraz provider register --namespace Microsoft.BatchRegister-AzResourceProvider -ProviderNamespace Microsoft.Batch
Createaz account management-group create --name 'Contoso' --display-name 'Contoso Group' (add --parent for a different parent)New-AzManagementGroup -GroupName 'Contoso' -DisplayName 'Contoso Group'
Renameaz account management-group update --name 'Contoso' --display-name 'Contoso Group'Update-AzManagementGroup -GroupId 'ContosoIt' -DisplayName 'Contoso Group'
Deleteaz account management-group delete --name 'Contoso'Remove-AzManagementGroup -GroupId 'Contoso'
List or showaz account management-group listGet-AzManagementGroup
Add a subscriptionaz account management-group subscription add --name 'Contoso' --subscription <id>New-AzManagementGroupSubscription -GroupId 'Contoso' -SubscriptionId <id>
Remove a subscriptionaz account management-group subscription remove --name 'Contoso' --subscription <id>Remove-AzManagementGroupSubscription -GroupId 'Contoso' -SubscriptionId <id>
Move a group under anotheraz account management-group update --name 'Contoso' --parent ContosoITUpdate-AzManagementGroup -GroupId 'Contoso' -ParentId $parentGroup.id

Users & Groups

TaskAzure CLIPowerShell
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

TaskAzure CLIPowerShell
Create planaz appservice plan create --name <plan> --resource-group <rg> --sku P0v3 --is-linuxNew-AzAppServicePlan -Name <plan> -Location <loc> -ResourceGroupName <rg> -Tier Free
Create web appaz webapp create --name <app> --resource-group <rg> --plan <plan> --runtime "NODE:24LTS"New-AzWebApp -Name <app> -Location <loc> -AppServicePlan <plan> -ResourceGroupName <rg>
Connection stringaz webapp config connection-string set -g <rg> -n <app> --connection-string-type SQLAzure --settings N=VSet-AzWebApp -ConnectionStrings $hash
Sticky settingaz webapp config appsettings set ... --settings K=V --slot-settings KSet-AzWebAppSlotConfigName -ResourceGroupName <rg> -Name <app> -AppSettingNames K
Add custom domainaz webapp config hostname add --webapp-name <app> --resource-group <rg> --hostname <fqdn>-
Upload PFXaz 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 Vaultaz webapp config ssl import --resource-group <rg> --name <app> --key-vault <vault> --key-vault-certificate-name <cert>-
Bind certificateaz webapp config ssl bind --certificate-thumbprint <tp> --ssl-type SNI --name <app> --resource-group <rg>New-AzWebAppSSLBinding ... -SslState SniEnabled
Key Vault access for App Serviceaz 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 backupaz 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 ruleaz 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 actionaz resource update -g <rg> -n <app> --resource-type Microsoft.Web/sites --set properties.siteConfig.ipSecurityRestrictionsDefaultAction=AllowSet-AzResource on the same property
VNet integrationaz webapp vnet-integration add -g <rg> -n <app> --vnet <vnet> --subnet <subnet>-
Create slotaz webapp deployment slot create --name <app> --resource-group <rg> --slot <slot>New-AzWebAppSlot -ResourceGroupName <rg> -Name <app> -Slot <slot> -AppServicePlan <plan>
Swap slotsaz 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 swapaz webapp deployment slot auto-swap -n <app> -g <rg> --slot <src>Set-AzWebAppSlot ... -AutoSwapSlotName production
Traffic routingaz webapp traffic-routing set -g <rg> -n <app> --distribution <slot>=15Add-AzWebAppTrafficRouting -ResourceGroupName <rg> -WebAppName <app> -RoutingRule @{ActionHostName='<url>';ReroutePercentage='15';Name='<slot>'}
Delete slotaz webapp deployment slot delete --name <app> -g <rg> --slot <slot>Remove-AzWebAppSlot -ResourceGroupName <rg> -Name <app> -Slot <slot>
Find IPsnslookup <app>.azurewebsites.net; az webapp show -g <rg> -n <app> --query outboundIpAddresses -o tsv(Get-AzWebApp -ResourceGroup <rg> -Name <app>).OutboundIpAddresses

App Service Plans

TaskAzure CLIPowerShell
Create Linux planaz appservice plan create -g <rg> -n <plan> --is-linux --sku B1-
Create Windows planaz appservice plan create -g <rg> -n <plan> --sku B1 --is-linux falseNew-AzAppServicePlan -ResourceGroupName <rg> -Name <plan> -Location <loc> -Tier Basic -NumberofWorkers 2 -WorkerSize Small
Windows container planaz appservice plan create -g <rg> -n <plan> --hyper-v --sku P1V3-
Plan in an ASEaz appservice plan create -g <rg> -n <plan> --app-service-environment <ase> --sku I1v2-
Scale up or downaz appservice plan update -g <rg> -n <plan> --sku P1v3Set-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 3Set-AzAppServicePlan -ResourceGroupName <rg> -Name <plan> -NumberofWorkers 3
Enable automatic scalingaz appservice plan update --name <plan> --resource-group <rg> --elastic-scale true --max-elastic-worker-count <n>-
Always ready instancesaz webapp update -g <rg> -n <app> --minimum-elastic-instance-count <n>-
Prewarmed instancesaz webapp update -g <rg> -n <app> --prewarmed-instance-count <n>-
Per-app scaling on planaz appservice plan update ... --set properties.perSiteScaling=trueSet-AzAppServicePlan ... -PerSiteScaling $true
Per-app worker limitaz webapp config set -g <rg> -n <app> --number-of-workers 5Set-AzWebApp ... -NumberOfWorkers 5
Create autoscale settingaz monitor autoscale create -g <rg> --resource <plan-id> --min-count 2 --max-count 5 --count 3-
Scale-out ruleaz monitor autoscale rule create -g <rg> --autoscale-name <name> --scale out 1 --condition "CpuPercentage > 75 avg 5m"-
Scale-in ruleaz monitor autoscale rule create -g <rg> --autoscale-name <name> --scale in 1 --condition "CpuPercentage < 25 avg 5m"-
Disable autoscaleaz monitor autoscale update -g <rg> -n <name> --enabled false-
List, show, delete planaz appservice plan list, show, delete -n <plan> -g <rg> --yesGet-AzAppServicePlan, Remove-AzAppServicePlan

ARM Templates & Bicep

TaskAzure CLIPowerShell
Deploy to a resource groupaz deployment group create -g <rg> --template-file main.bicep --parameters storageAccountType=Standard_GRSNew-AzResourceGroupDeployment -ResourceGroupName <rg> -TemplateFile main.bicep
Deploy to a subscriptionaz deployment sub create --location <loc> --template-file main.bicepNew-AzSubscriptionDeployment
Deploy to a management group or tenantaz deployment mg create / az deployment tenant create (both need --location)-
Complete modeaz deployment group create --mode Complete …New-AzResourceGroupDeployment -Mode Complete …
Preview (what-if)az deployment group what-if …, or --confirm-with-what-if / -cNew-AzResourceGroupDeployment -Whatif or -Confirm
Bicep parameter fileaz deployment group create -g <rg> --parameters storage.bicepparam-
ARM to Bicepaz bicep decompile --file main.jsonbicep decompile main.json
Bicep to ARMaz bicep build --file main.bicepbicep build main.bicep
Export an RG templateaz group export --name <rg>Export-AzResourceGroup -ResourceGroupName <rg> -Path ./main.json

Availability & Scale Sets

TaskAzure CLIPowerShell
Create availability setaz vm availability-set create -n MyAvSet -g MyRG --platform-fault-domain-count 2 --platform-update-domain-count 2New-AzAvailabilitySet -Location EastUS -Name myAvailabilitySet -ResourceGroupName myRG -Sku aligned -PlatformFaultDomainCount 2 -PlatformUpdateDomainCount 2
Create VM in the setaz vm create ... --availability-set MyAvSetNew-AzVM ... -AvailabilitySetName "myAvailabilitySet"
Convert set to managed disksaz vm availability-set convert -g MyRG -n MyAvSet-
Zonal VMaz vm create -g myRG -n myVM --image Ubuntu2204 --generate-ssh-keys --zone 1-
Zone-spanning Flexible scale setaz vmss create -g myRG -n myScaleSet --orchestration-mode Flexible --image Ubuntu2204 --admin-username azureuser --zones 1 2 3 --generate-ssh-keysNew-AzVmss -ResourceGroupName myRG -Location EastUS -VMScaleSetName myScaleSet -OrchestrationMode Flexible
Manual scaleaz vmss scale --new-capacity 5 --name scaleSetName --resource-group rgUpdate-AzVmss -SkuCapacity 5 -ResourceGroupName rg -VMScaleSetName scaleSetName
Autoscale profileaz monitor autoscale create --resource-group rg --resource myScaleSet --resource-type Microsoft.Compute/virtualMachineScaleSets --name autoscale --min-count 2 --max-count 10 --count 2New-AzAutoscaleProfileObject, then New-AzAutoscaleSetting
Scale-out ruleaz monitor autoscale rule create -g rg --autoscale-name autoscale --condition "Percentage CPU > 70 avg 5m" --scale out 3New-AzAutoscaleScaleRuleObject ...
Scale-in ruleaz monitor autoscale rule create ... --condition "Percentage CPU < 30 avg 5m" --scale in 1same cmdlet with LessThan and Decrease
Scale-in policyaz vmss update -g rg -n vmss --scale-in-policy OldestVMUpdate-AzVmss -ResourceGroupName rg -VMScaleSetName vmss -ScaleInPolicy "OldestVM"
Instance protectionaz 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 updateaz vmss update ... --enable-automatic-repairs true --automatic-repairs-grace-period 30 --automatic-repairs-action ReplaceUpdate-AzVmss ... -EnableAutomaticRepair $true -AutomaticRepairGracePeriod "PT40M" -AutomaticRepairAction "Restart"
Update instances to latest modelaz vmss update-instances -g rg -n vmss --instance-ids "*"Update-AzVmssInstance -ResourceGroupName rg -VMScaleSetName vmss -InstanceId '*'
Attach existing VM to Flexible scale setaz vm update -g rg -n vm --set virtualMachineScaleSet.id='<vmssId>'Update-AzVM -ResourceGroupName rg -VM $vm -VirtualMachineScaleSetId $vmss.Id

Containers

TaskAzure CLIPowerShell
Create registry (Premium)az acr create -n myregistry -g myrg -l <region> --sku Premium-
Change SKUaz acr update --name myContainerRegistry --sku PremiumUpdate-AzContainerRegistry -ResourceGroupName myResourceGroup -Name myContainerRegistry -Sku Premium
Sign in to registryaz acr login --name <registry>Connect-AzContainerRegistry -Name <registry>
Enable admin useraz acr update -n <registry> --admin-enabled trueUpdate-AzContainerRegistry -Name <registry> -ResourceGroupName <rg> -EnableAdminUser
Cloud buildaz acr build --registry <acr> --image <repo>:<tag> <context>-
Add geo-replicaaz acr replication create --registry <acr> --location <region>-
Grant AcrPullaz role assignment create --assignee $SPID --scope <registry-id> --role acrpullNew-AzRoleAssignment -ObjectId $PrincipalId -Scope $RegistryId -RoleDefinitionName acrpull
ACI with restart policyaz container create -g myRG --name mycontainer --image <img> --restart-policy OnFailureNew-AzContainerGroup -ResourceGroupName myRG -Name mycontainer -Image <img> -RestartPolicy OnFailure
ACI DNS label and portaz container create ... --dns-name-label aci-demo --ports 80-
ACI pull via managed identityaz container create ... --acr-identity $USERID --assign-identity $USERID-
ACI logs, shell, exportaz container logs, az container exec --exec-command "/bin/sh", az container exportGet-AzContainerInstanceLog -ResourceGroupName myRG -ContainerGroupName name
Container Apps extension and provideraz extension add --name containerapp --upgrade; az provider register --namespace Microsoft.AppInstall-Module -Name Az.App; Register-AzResourceProvider -ProviderNamespace Microsoft.App
Create environmentaz containerapp env create --name <env> --resource-group <rg> --location <loc>New-AzContainerAppManagedEnv @EnvArgs
Create app with ingress and scaleaz 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 50New-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

TaskAzure CLIPowerShell
Create a vault for ADEaz keyvault create --name <kv> -g <rg> --location eastus --enabled-for-disk-encryptionNew-AzKeyVault -Name <kv> -ResourceGroupName <rg> -Location EastUS -EnabledForDiskEncryption
Enable disk encryption on an existing vaultaz keyvault update --name <kv> -g <rg> --enabled-for-disk-encryption trueSet-AzKeyVaultAccessPolicy -VaultName <kv> -ResourceGroupName <rg> -EnabledForDiskEncryption
Create a KEKaz keyvault key create --name myKEK --vault-name <kv> --kty RSA --size 4096Add-AzKeyVaultKey -Name myKEK -VaultName <kv> -Destination HSM -Size 4096
Enable ADEaz 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 statusaz vm encryption show --name <vm> -g <rg>Get-AzVmDiskEncryptionStatus -VMName <vm> -ResourceGroupName <rg>
Disable ADEaz vm encryption disable --resource-group <rg> --name <vm> --volume-type allDisable-AzVMDiskEncryption -ResourceGroupName <rg> -VMName <vm> -VolumeType all
Register encryption at hostaz feature register --name EncryptionAtHost --namespace Microsoft.Compute, then az feature showRegister-AzProviderFeature -FeatureName EncryptionAtHost -ProviderNamespace Microsoft.Compute, then Get-AzProviderFeature
VM with encryption at hostaz vm create … --encryption-at-host true; existing VM: az vm update … --encryption-at-host trueSet-AzVMSecurityProfile -VM $vmConfig -EncryptionAtHost $true, then New-AzVM
Verify encryption at hostaz vm show -g <rg> -n <vm> --query "securityProfile.encryptionAtHost"(Get-AzVM …).SecurityProfile.EncryptionAtHost

Moving Resources

TaskAzure CLIPowerShell
Move to another RGaz resource move --destination-group <rg> --ids <id1> <id2>Move-AzResource -DestinationResourceGroupName <rg> -ResourceId $ids
Move to another subscriptionAdd --destination-subscription-id <sub>Add -DestinationSubscriptionId <sub>
Validate a moveaz resource invoke-action --action validateMoveResources --ids <source-rg-id> --request-body "{…}"Invoke-AzResourceAction -Action validateMoveResources -ResourceId <rg-id> -Parameters @{…}
Compare tenantsaz account show --subscription <s> --query tenantId(Get-AzSubscription -SubscriptionName <s>).TenantId
Register a provideraz provider register --namespace Microsoft.BatchRegister-AzResourceProvider -ProviderNamespace Microsoft.Batch
Find Backup restore pointsaz 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 pointsaz resource delete --ids $RESTOREPOINTCOLRemove-AzResource -ResourceId … -Force
Disable ADE before a subscription moveaz vm encryption disable -g <rg> -n <vm> --volume-type allDisable-AzVMDiskEncryption -ResourceGroupName <rg> -VMName <vm> -VolumeType all

Virtual Machines

TaskAzure CLIPowerShell
List resize optionsaz vm list-vm-resize-options -g <rg> -n <vm>Get-AzVMSize -ResourceGroupName <rg> -VMName <vm>
Resizeaz vm resize -g <rg> -n <vm> --size Standard_DS3_v2$vm.HardwareProfile.VmSize='…'; Update-AzVM -VM $vm -ResourceGroupName <rg>
Deallocate / startaz vm deallocate / az vm startStop-AzVM / Start-AzVM
Change disk typeaz 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 LUNaz 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-keysNew-AzVM -ResourceGroupName MyRG -Name MyVm -Credential (Get-Credential) -Image <img> -Size <size> -Zone 1
Create a Spot VMaz vm create … --priority Spot --eviction-policy Deallocate --max-price -1New-AzVM … -Priority Spot -EvictionPolicy Deallocate
Enable Hybrid Benefitaz vm update -g MyRG -n MyVm --set licenseType=Windows_Server$vm.LicenseType="Windows_Server"; Update-AzVM -ResourceGroupName MyRG -VM $vm (None reverts)
Trusted Launchaz vm create … --security-type TrustedLaunchNew-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

TaskAzure CLIPowerShell
Create a provisioned shareaz storage share-rm create --resource-group <rg> --storage-account <n> --name <share> --quota 1024 --enabled-protocols SMBNew-AzRmStorageShare ... -QuotaGiB 1024 -EnabledProtocol SMB
Create a snapshotaz storage share snapshot --name <share> --account-name <n>New-AzRmStorageShare ... -Snapshot
Delete share and snapshotsaz storage share delete --name <share> --account-name <n> --delete-snapshots includeRemove-AzRmStorageShare ... -Include Snapshots
Enable soft deleteaz storage account file-service-properties update -g <rg> --account-name <n> --enable-delete-retention true --delete-retention-days 7Update-AzStorageFileServiceProperty ... -EnableShareDeleteRetentionPolicy $true -ShareRetentionDays 7
Restore a deleted shareaz storage share-rm restore --name <share> --deleted-version <v> -g <rg> --storage-account <n>Restore-AzRmStorageShare ... -DeletedShareVersion <v>
Enable Entra Kerberosaz storage account update --name <n> --resource-group <rg> --enable-files-aadkerb trueSet-AzStorageAccount ... -EnableAzureActiveDirectoryKerberosForFile $true
Default share permissionaz storage account update --name <n> --resource-group <rg> --default-share-permission StorageFileDataSmbShareContributorSet-AzStorageAccount ... -DefaultSharePermission StorageFileDataSmbShareContributor

Blob Tiers & Lifecycle

TaskAzure CLIPowerShell
Create a containeraz storage container create --account-name <n> --name <c> --auth-mode loginNew-AzStorageContainer -Name <c> -Context $ctx -Permission Off
Set anonymous access levelaz storage container set-permission --name <c> --account-name <n> --public-access container --auth-mode keySet-AzStorageContainerAcl -Container <c> -Permission Container -Context $ctx
Change tier or rehydrateaz 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 copyaz 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 loginStart-AzStorageBlobCopy ... -StandardBlobTier Hot -RehydratePriority Standard
Create a lifecycle policyaz 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 trackingaz storage account blob-service-properties update --resource-group <rg> --account-name <n> --enable-last-access-tracking trueEnable-AzStorageBlobLastAccessTimeTracking -ResourceGroupName <rg> -StorageAccountName <n> -PassThru

Blob Versioning & Soft Delete

TaskAzure CLIPowerShell
Enable versioningaz storage account blob-service-properties update --resource-group <rg> --account-name <n> --enable-versioning trueUpdate-AzStorageBlobServiceProperty -ResourceGroupName <rg> -StorageAccountName <n> -IsVersioningEnabled $true
List versionsaz storage blob list --container-name <c> --account-name <n> --include v --auth-mode loginGet-AzStorageBlob -Container <c> -IncludeVersion -Context $ctx
Enable blob soft deleteaz storage account blob-service-properties update ... --enable-delete-retention true --delete-retention-days 14Enable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName <rg> -StorageAccountName <n> -RetentionDays 14
Enable container soft deleteaz 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 trueUpdate-AzStorageBlobServiceProperty ... -EnableChangeFeed $true -IsVersioningEnabled $true
Enable PITR... --enable-restore-policy true --restore-days 7Enable-AzStorageBlobRestorePolicy -ResourceGroupName <rg> -StorageAccountName <n> -RestoreDays 7
Restore all containersaz storage blob restore --resource-group <rg> --account-name <n> --time-to-restore 2026-11-12T06:31:22Z --no-waitRestore-AzStorageBlobRange -ResourceGroupName <rg> -StorageAccountName <n> -TimeToRestore (Get-Date).ToUniversalTime().AddHours(-12)
Restore rangesaz storage blob restore ... --blob-range container3/d container3/gNew-AzStorageBlobRangeToRestore -StartRange container1 -EndRange container2, then Restore-AzStorageBlobRange -BlobRestoreRange $range ...
Check restore statusaz storage account show --name <n> --resource-group <rg> --expand blobRestoreStatus --query blobRestoreStatus.status$restoreOperation.Status

Storage Encryption

TaskAzure CLIPowerShell
Create a vault with purge protection and RBACaz keyvault create --name <kv> --resource-group <rg> --location <loc> --enable-purge-protection --enable-rbac-authorizationNew-AzKeyVault -Name <kv> -ResourceGroupName <rg> -Location <loc> -EnablePurgeProtection -EnableRbacAuthorization
Create a keyaz keyvault key create --name <key> --vault-name <kv>Add-AzKeyVaultKey -VaultName <kv> -Name <key> -Destination Software
Assign a system identity to the accountaz storage account update --name <n> --resource-group <rg> --assign-identitySet-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 keysaz storage account update ... --encryption-key-source Microsoft.StorageSet-AzStorageAccount ... -StorageEncryption
Revoke (disable the key)az keyvault key set-attributes --vault-name <kv> --name <key> --enabled falseUpdate-AzKeyVaultKey -VaultName <kv> -Name <key> -Enable $false
Create an account with infrastructure encryptionaz storage account create ... --require-infrastructure-encryptionNew-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.StorageNew-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 overrideaz storage container create --account-name <n> --name <c> --default-encryption-scope <scope> --prevent-encryption-scope-override true --auth-mode loginNew-AzStorageContainer -Name <c> -Context $ctx -DefaultEncryptionScope <scope> -PreventEncryptionScopeOverride $true
Upload a blob with a scopeaz storage blob upload ... --encryption-scope <scope>Set-AzStorageBlobContent ... -EncryptionScope <scope>
Disable a scopeaz storage account encryption-scope update ... --state DisabledUpdate-AzStorageEncryptionScope ... -State disabled

Object Replication

TaskAzure CLIPowerShell
Enable versioning and change feed (source)az storage account blob-service-properties update --resource-group <rg> --account-name <src> --enable-versioning --enable-change-feedUpdate-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-versioningUpdate-AzStorageBlobServiceProperty ... -IsVersioningEnabled $true
Create the policy on the destinationaz 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 aSet-AzStorageObjectReplicationPolicy -ResourceGroupName <rg> -StorageAccountName <dest> -PolicyId default -SourceAccount <src> -Rule $rule1,$rule2
Add a ruleaz storage account or-policy rule add --account-name <dest> --resource-group <rg> --source-container <c> --destination-container <c> --policy-id <id> --prefix-match bNew-AzStorageObjectReplicationPolicyRule
Apply the policy to the sourceaz 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 statusaz storage blob show ... --query 'objectReplicationSourceProperties[].rules[].status'$blob.BlobProperties.ObjectReplicationSourceProperties[0].Rules[0].ReplicationStatus
Delete a policyaz 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

TaskAzure CLIPowerShell
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 failoveraz storage account failover --failover-type planned|unplanned-
Check Last Sync Time before a failoveraz storage account show --expand geoReplicationStats-

Storage Access

TaskAzure CLIPowerShell
List keysaz storage account keys list --resource-group <rg> --account-name <n>Get-AzStorageAccountKey -ResourceGroupName <rg> -Name <n>
Regenerate a keyaz storage account keys renew --resource-group <rg> --account-name <n> --key primaryNew-AzStorageAccountKey -ResourceGroupName <rg> -Name <n> -KeyName key1
Disallow Shared Keyaz storage account update --name <n> --resource-group <rg> --allow-shared-key-access falseSet-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 keysaz storage account revoke-delegation-keys --name <n> --resource-group <rg>-
Stored access policyaz storage container policy create --container-name <c> --name <p> --permissions <rwdl> --start <dt> --expiry <dt> --account-name <n>-
SAS expiration policyaz storage account update --name <n> --resource-group <rg> --sas-exp 1.12:05:06 --sas-expiration-action BlockSet-AzStorageAccount ... -SasExpirationPeriod 1.12:05:06 -SasExpirationAction Block
Default action Denyaz storage account update -g <rg> -n <n> --default-action DenyUpdate-AzStorageAccountNetworkRuleSet -ResourceGroupName <rg> -Name <n> -DefaultAction Deny
Service endpoint on a subnetaz 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 ruleaz storage account network-rule add -g <rg> --account-name <n> --subnet <subnetId>Add-AzStorageAccountNetworkRule -ResourceGroupName <rg> -Name <n> -VirtualNetworkResourceId $subnet.Id
Add an IP ruleaz 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 exceptionsaz storage account update -g <rg> -n <n> --bypass Logging Metrics AzureServicesUpdate-AzStorageAccountNetworkRuleSet -ResourceGroupName <rg> -Name <n> -Bypass AzureServices,Metrics,Logging
Block anonymous accessaz storage account update ... --allow-blob-public-access false-AllowBlobPublicAccess $false
Container access levelaz storage container set-permission --name <c> --account-name <n> --public-access container|blob|off --auth-mode keySet-AzStorageContainerAcl -Container <c> -Permission Container -Context $ctx

Storage Accounts

TaskAzure CLIPowerShell
Create a GPv2 RA-GRS accountaz storage account create --name <n> --resource-group <rg> --location eastus --sku Standard_RAGRS --kind StorageV2 --min-tls-version TLS1_2 --allow-blob-public-access falseNew-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 GPv2az storage account update -g <rg> -n <n> --set kind=StorageV2Set-AzStorageAccount -ResourceGroupName <rg> -AccountName <n> -UpgradeToStorageV2

AzCopy & Storage Explorer (AzCopy v10)

AzCopy is its own tool, not the Azure CLI or PowerShell.

TaskAzCopy command
Sign in with Microsoft Entra IDazcopy login
Create a containerazcopy make 'https://<acct>.blob.core.windows.net/<container>'
Upload a folder with subfoldersazcopy copy 'C:\myDirectory' '<container-url>' --recursive
Upload folder contents onlyazcopy copy 'C:\myDirectory\*' '<container-url>/<dir>'
Copy a container between accountsazcopy copy '<src-container-url>' '<dst-container-url>' --recursive
Incremental updateazcopy sync '<local-path>' '<container-url>' --recursive
Mirror deletes tooazcopy sync ... --delete-destination=true
Upload straight to Archiveazcopy copy ... --block-blob-tier=Archive
Resume an interrupted jobazcopy 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

TaskAzure CLIPowerShell
Create a public zoneaz network dns zone create -g MyResourceGroup -n contoso.xyz-
Add an A recordaz network dns record-set a add-record -g MyResourceGroup -z contoso.xyz -n www -a 10.10.10.10-
List recordsaz network dns record-set list -g MyResourceGroup -z contoso.xyz-
Show name serversaz network dns record-set ns show --resource-group MyResourceGroup --zone-name contoso.xyz --name @-
Test before delegationnslookup www.contoso.xyz <azure name server>-
Create a private zoneaz 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 Contributoraz 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

TaskAzure CLIPowerShell
Create the subnetaz network vnet subnet create --name AzureBastionSubnet --resource-group TestRG1 --vnet-name VNet1 --address-prefix 10.1.1.0/26-
Create the public IPaz 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 SKUaz network bastion create --name MyBastion --resource-group MyResourceGroup --sku Developer --vnet-name MyVnet (no subnet or public IP needed)-
Turn on native clientaz network bastion update --name MyBastionHost --resource-group MyResourceGroup --enable-tunneling-
Native SSHaz network bastion ssh --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --auth-type password --username xyz (--auth-type is required)-
Native RDPaz network bastion rdp --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId-
Tunnelaz network bastion tunnel --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --resource-port 22 --port 50022-

Service & Private Endpoints

TaskAzure CLIPowerShell
Subnet with service endpointaz 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 actionaz storage account update --name $acct -g test-rg --default-action Deny-
Allow the subnet on storageaz storage account network-rule add -g test-rg --account-name $acct --vnet-name vnet-1 --subnet subnet-private-
Create a private endpointaz 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 zoneaz network private-dns zone create -g test-rg --name "privatelink.azurewebsites.net"-
Link zone to vnetaz 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 groupaz 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

TaskAzure CLIPowerShell
Create a Standard public load balanceraz 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 balanceraz 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 probeaz network lb probe create -g rg --lb-name load-balancer -n lb-health-probe --protocol tcp --port 80-
Load-balancing ruleaz 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 poolaz 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 ruleaz 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 subnetaz 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

TaskAzure CLIPowerShell
IP flow verifyaz network watcher test-ip-flow -g MyResourceGroup --direction Outbound --protocol TCP --local 10.0.0.4:* --remote 10.1.0.4:80 --vm MyVmnot covered here
Next hopaz network watcher show-next-hop -g MyResourceGroup --vm MyVm --source-ip 10.0.0.4 --dest-ip 10.1.0.4Get-AzNetworkWatcherNextHop
Effective security rulesaz network nic list-effective-nsg --name vm-nic --resource-group test-rgGet-AzEffectiveNetworkSecurityGroup -NetworkInterfaceName vm-nic -ResourceGroupName test-rg
Effective routesaz network nic show-effective-route-tableGet-AzEffectiveRouteTable
Connectivity test (preview)az network watcher test-connectivity -g MyResourceGroup --source-resource MyVmName1 --dest-resource MyVmName2 --dest-port 80not covered here
Enable Network Watcher in a regionaz network watcher configure -g NetworkWatcherRG -l westus --enabled truenot covered here

NSGs & ASGs

TaskAzure CLIPowerShell
Create NSGaz network nsg create -g myResourceGroup -n myNSGNew-AzNetworkSecurityGroup -Name myNSG -ResourceGroupName myResourceGroup -Location eastus
Create ruleaz 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 ruleaz network nsg rule update ... --priority 200Set-AzNetworkSecurityRuleConfig, then Set-AzNetworkSecurityGroup
Associate to a subnetaz network vnet subnet update -g myRG --vnet-name myVNet -n mySubnet --network-security-group myNSGSet-AzVirtualNetworkSubnetConfig -NetworkSecurityGroup, then Set-AzVirtualNetwork
Create ASGaz network asg create -g myRG -n myASG -l eastusNew-AzApplicationSecurityGroup
Effective security rulesaz network nic list-effective-nsg --name vm-nic -g test-rgGet-AzEffectiveNetworkSecurityGroup -NetworkInterfaceName vm-nic -ResourceGroupName test-rg

VNet Peering

TaskAzure CLIPowerShell
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-trafficAdd-AzVirtualNetworkPeering -Name vnet-1-to-vnet-2 -VirtualNetwork $vnet1 -RemoteVirtualNetworkId $vnet2.Id
List / showaz network vnet peering list, az network vnet peering showGet-AzVirtualNetworkPeering
Change a settingaz network vnet peering update ... --set allowForwardedTraffic=falseSet $peering.AllowForwardedTraffic, then Set-AzVirtualNetworkPeering
Sync after an address space changeaz network vnet peering sync -g MyResourceGroup -n MyVnet1ToMyVnet2 --vnet-name MyVnet1Sync from the portal or PowerShell
Deleteaz network vnet peering deleteRemove-AzVirtualNetworkPeering

Public IP Addresses

TaskAzure CLIPowerShell
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

TaskAzure CLIPowerShell
Create route tableaz network route-table createNew-AzRouteTable
Add routeaz 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.4New-AzRouteConfig -Name StorageRoute -AddressPrefix Storage -NextHopType VirtualAppliance -NextHopIpAddress 10.0.100.4, add to the table, then Set-AzRouteTable
Associate or dissociateaz network vnet subnet update (with the route table)Set-AzVirtualNetworkSubnetConfig
Effective routesaz network nic show-effective-route-tableGet-AzEffectiveRouteTable
Next hop testaz network watcher show-next-hopGet-AzNetworkWatcherNextHop
Delete route tableaz network route-table deleteRemove-AzRouteTable

VNets & Subnets

TaskAzure CLIPowerShell
Create vnetaz 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 subnetaz network vnet create ... --address-prefix 10.0.0.0/16 --subnet-name subnet-1 --subnet-prefix 10.0.0.0/24New-AzVirtualNetworkSubnetConfig, then New-AzVirtualNetwork -Subnet
Replace address spaceaz 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 DNSaz network vnet update ... --dns-servers 10.0.0.10$vnet.DhcpOptions.DnsServers.Add("10.0.0.10"), then Set-AzVirtualNetwork
Delegate a subnetaz network vnet subnet update -g rg --vnet-name vnet-1 -n subnet-1 --delegations Microsoft.Sql/managedInstancesAdd-AzDelegation, then Set-AzVirtualNetwork
Remove delegationaz network vnet subnet update ... --remove delegationsRemove-AzDelegation, then Set-AzVirtualNetwork
Make subnet privateaz network vnet subnet update --resource-group rgname --name subnetname --vnet-name vnetname --default-outbound falseSet $subnet.DefaultOutboundAccess = $false, then Set-AzVirtualNetwork
Delete vnetaz network vnet deleteRemove-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

TaskAzure CLIPowerShell
Create an alert processing ruleaz extension add --name alertsmanagement, then az monitor alert-processing-rule create --name N --rule-type AddActionGroups --scopes /subscriptions/SUB1 --action-groups <id> --resource-group RGSet-AzAlertProcessingRule -Name N -AlertProcessingRuleType AddActionGroups -Scope /subscriptions/SUB1 -ActionGroupId <id> -ResourceGroupName RG
List, show, update, delete processing rulesaz monitor alert-processing-rule list|show|update|deleteGet-, Update-, Remove-AzAlertProcessingRule
Create a metric alertaz 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 illustrationNot covered on the page
Create an action groupaz 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-receiversNot covered on the page
Create an action group as codeARM resource Microsoft.Insights/actionGroupsSame template

Azure Monitor

TaskAzure CLIPowerShell
Create a resource diagnostic settingaz 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 logaz monitor diagnostic-settings subscription create (or update)Not supported with New-AzDiagnosticSetting; use an ARM template
Use resource-specific tablesAdd --export-to-resource-specific trueNot covered on the page
Install Azure Monitor Agent on a Windows VMaz vm extension set --name AzureMonitorWindowsAgent --publisher Microsoft.Azure.Monitor --vm-name VM --resource-group RGNot covered on the page
Associate a DCR with a VMaz monitor data-collection rule association create --name A --rule-id <dcr> --resource <vm id>New-AzDataCollectionRuleAssociation -AssociationName A -ResourceUri <vm id> -DataCollectionRuleId <dcr>
Read metricsaz monitor metrics command groupAz.Monitor module cmdlets

Backup & Restore

TaskAzure CLIPowerShell
Enable backupaz 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 disksaz 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 dataaz backup protection disable ... --delete-backup-data trueDisable-AzRecoveryServicesBackupProtection -Item $item -RemoveRecoveryPoints
Instant Restore retention—$pol.SnapshotRetentionInDays=5 then Set-AzRecoveryServicesBackupProtectionPolicy -policy $pol
Diagnostics for reportsaz monitor diagnostic-settings create on the vaultNew-AzDiagnosticSetting

Backup Vaults

TaskAzure CLIPowerShell
Delete vaultaz backup vault delete --name V --resource-group RG --force --yes (VM backups only)Remove-AzRecoveryServicesVault -Vault $vault
Stop protection and delete dataaz backup protection disable --container-name C --item-name I --delete-backup-data true --vault-name V --resource-group RG --yesDisable-AzRecoveryServicesBackupProtection -Item $item -RemoveRecoveryPoints -Force
Unregister MARS or MABS—Unregister-AzRecoveryServicesBackupContainer, Unregister-AzRecoveryServicesBackupManagementServer

Insights

TaskAzure CLIPowerShell
Install Azure Monitor Agent (Windows VM)az vm extension set --name AzureMonitorWindowsAgent --publisher Microsoft.Azure.MonitorSee the install page
Associate a DCRaz monitor data-collection rule association createNew-AzDataCollectionRuleAssociation

Network Watcher

TaskAzure CLIPowerShell
IP flow verifyaz network watcher test-ip-flow -g MyResourceGroup --direction Outbound --protocol TCP --local 10.0.0.4:* --remote 10.1.0.4:80 --vm MyVmTest-AzNetworkWatcherIPFlow
Next hopaz 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 monitorNot named on the Connection Monitor overview pagePowerShell is supported, as are the portal and ARMClient
Stateful inbound TCP flow timeoutNot 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.