Availability & Scale Sets
availability sets · zones · proximity placement · scale set modes · autoscale · scale-in · repairs · upgrades
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
Availability sets vs availability zones
| Availability set | Availability zone | |
|---|---|---|
| What it spreads VMs across | Fault domains (shared power source and network switch) and update domains (planned maintenance groups) | Physically separate zones in a region; each has distinct power, network and cooling |
| Protects against | Physical hardware, network and power failures; planned maintenance one update domain at a time | Loss of a zone, if you deploy VMs in more than one zone and load-balance them |
| Does not protect against | OS or application failures; datacenter-level shared failures such as a datacenter network outage | A single zonal VM is pinned to one zone and is not resilient to an outage of that zone by itself |
| SLA | 99.95% with two or more VMs in the set | The VM SLA uptime percentage increases with two or more VMs across two or more zones |
| Limits | Up to 3 fault domains and 20 update domains, fixed at creation | Three zones per supported region (a few regions list four) |
| Cost | No charge for the set; you pay for the VMs | No cost difference between zonal and nonzonal VMs |
| Add an existing VM | Only when the VM is created: delete and re-create the VM in the set | A nonzonal VM can be moved to a zonal VM (new VM in the target zone). A zonal VM can't be converted back |
Availability options are separate choices (zone, availability set, scale set, none). The orchestration-modes comparison lists availability sets as not supporting availability zones.
Availability set details
- Fault domains are VMs sharing a common power source and network switch. Update domains are restarted one at a time during planned maintenance; a restarted update domain gets 30 minutes to recover before the next one starts, and the restart order may not be sequential.
- With 5 update domains and more than 5 VMs, the 6th VM lands in the same update domain as the 1st, and so on.
- Set the fault and update domain counts when you create the set. They can't be changed afterwards.
- Only VMs with managed disks can be created in a managed (Aligned) availability set. Managed-disk fault domains per region are either 2 or 3.
az vm availability-set createdefaults to 2 fault domains. If you leave out the update domain count, the server picks one (for example 5).- If you deploy VM1, stop and deallocate it, then deploy VM2, the two VMs can end up in the same fault domain. Don't stop or deallocate VMs between deployments.
- Create the availability set first, then create each VM in it. Check the VM sizes allowed in the set with
az vm availability-set list-sizes. - Microsoft's current recommendation is Virtual Machine Scale Sets with Flexible orchestration. Availability sets give high availability but not the same resiliency as availability zones.
Availability zones for VMs
- Zone numbers are logical zones. The mapping to physical zones differs per subscription (check with
az account list-locations). - A VM created in a zone gets its managed disk in the same zone, and by default the public IP created with it is in that zone too.
- Portal: Create VM > Basics > Availability options = Availability zone. Zone 1 is the default. Selecting several zones creates one VM per zone, named with the suffixes -1, -2, -3. You can add an Azure load balancer or Application Gateway on the Networking tab.
- CLI: check which zones offer a size with
az vm list-skus --location <region> --output table(Zones column), thenaz vm create ... --zone 1. - Zone-resilient design: one VM in each of zones 1, 2 and 3 behind a zone-redundant (Standard) load balancer or Application Gateway. You are responsible for traffic routing and data replication.
- Inter-zone round-trip latency target is under about 2 ms. There is no data transfer charge between zones in the same region.
- Zone resilience for a standalone zonal VM (failover to another zone) is a preview feature. Don't treat it as generally available.
Proximity placement groups
- A proximity placement group (PPG) places compute physically close together for low latency. Create it first. Set it at the availability set or scale set level, not per VM.
- Moving an existing resource into a PPG requires stopping (deallocating) it first.
- A single PPG can't span zones. The extra placement constraint means
OverconstrainedAllocationRequestorAllocationFailureerrors are possible. - The optional
intent(VM sizes, one optional zone set only at creation) improves placement. It gives no capacity guarantee. - Colocation status is Aligned, Unknown (a VM is deallocated) or Not aligned. Fix Not aligned by stopping (deallocating) and restarting; do the VMs in the availability set or scale set first.
Scale set orchestration modes
| Flexible (recommended) | Uniform | |
|---|---|---|
| Instances | Standard Azure IaaS VMs; use the standard VM APIs | Scale-set-specific VMs; not compatible with the standard VM APIs, ARM tagging, per-VM RBAC, Azure Backup or Site Recovery |
| Add or remove existing VMs | Yes | No |
| Azure Backup, Site Recovery (PowerShell), assign a VM to a zone or fault domain | Yes | No |
| Automatic OS image upgrades, Basic Load Balancer, NAT pools, default outbound connectivity | Not supported | Supported |
| Update domains | None; host updates go fault domain by fault domain | Up to 5 |
| SLA | 99.95% across fault domains; 99.99% across multiple zones | 99.95% for FD>1 in a single placement group; 99.99% across multiple zones |
- The orchestration mode is set at creation and can't be changed.
- Since November 2023, scale sets created with PowerShell or Azure CLI default to Flexible if you don't specify a mode.
- Flexible instances have no default outbound connectivity. Use a NAT gateway, load balancer outbound rules or a public IP.
- Flexible doesn't support a single placement group, overprovisioning, health from a load balancer probe (use the Application Health extension), unmanaged disks, Basic Load Balancer, NAT pools (use NAT rules) or system-assigned managed identity (use user-assigned).
- To protect a scale set from datacenter-level failures, create it across availability zones.
- Microsoft's pages differ on the maximum instance count and the Uniform limits, so don't memorize a Uniform figure. Flexible can mix VM types, Spot and on-demand, and Windows and Linux, and supports up to 1,000 VMs (200 when VM sizes lack memory-preserving updates and you use fixed spreading).
Zones and fault domains in scale sets
- Zone options: zone-spanning (several zones), zonal (one zone) or regional (no zones). Spreading instances across zones gives the 99.99% SLA and is recommended for most workloads.
- Zone distribution is best-effort even by default. Set
zoneBalance: truefor strict balance (each zone has the same VM count plus or minus one). - You can add zones to an existing scale set. Existing instances don't move and adding a zone doesn't trigger rebalancing; balancing happens only on scale-out. Adding zones is one of the changes that needs a restart, reimage or redeploy of instances.
platformFaultDomainCount = 1is max spreading: best effort across as many fault domains as possible, and Microsoft recommends it for most scale sets. A value above 1 is fixed spreading, and the request fails if it can't be met.
Autoscale
| Item | Detail |
|---|---|
| Methods | Manual capacity, schedule, metric rules, or predictive autoscale. Autoscale needs the scale set to have a virtual machine scaling profile |
| Profile | Minimum, maximum and default instance counts. If min = max, no scale action can occur |
| Default count | Used when metrics can't be read. Below default: scale out to default. Above default: no scale in |
| Rule logic | Scale out if ANY rule is met. Scale in only if ALL scale-in rules are met |
| Pairing | Always pair a scale-out rule with a scale-in rule, ideally on the same metric, to avoid flapping |
| Manual change outside min and max | Autoscale resets it on its next run (range 3-6, you set 8, it goes back to 6) |
| Host metrics (no agent) | Percentage CPU, Network In/Out, Disk Read/Write Bytes and Operations/Sec, CPU Credits Remaining and Consumed |
| In-guest metrics such as memory | Need the Azure diagnostics extension or Application Insights |
| Portal example rule | Percentage CPU, Average, Greater than 70, 10 minutes, Increase percent by 20, cool down 5 minutes; scale in at CPU less than 30 |
| Recurring schedule profile | Has no end time and stays active until the next profile starts. Create another recurring profile to end it |
Scale-in, protection and instance repairs
- Scale-in policy values: Default, NewestVM, OldestVM. Default balances across zones, then fault domains (best effort), then deletes the VM with the highest instance ID. NewestVM and OldestVM balance across zones first, then pick the newest or oldest in the imbalanced zone.
- Protect from scale-in blocks only autoscale-initiated scale-in. Protect from scale set actions also blocks scale-set-initiated upgrade, reimage and deallocate. Neither stops you deleting the instance or the whole scale set. Protection is set per instance, on the instance model.
- You can't set protectFromScaleIn to false while protectFromScaleSetActions is true. A protected instance is skipped by scale-in and isn't repaired.
- Automatic instance repairs need health from the Application Health extension OR a load balancer health probe, not both. Default action is Replace; Reimage and Restart are also available. Grace period is 10 to 90 minutes (default 10). At most 5% of instances are repaired at once; with fewer than 20 instances, one at a time. Not supported on Service Fabric scale sets.
- Replace keeps nothing (new instance ID, IP and disks). Reimage keeps the instance ID, private IP and data disks but not the OS disk. Restart keeps everything. To change the repair action, disable then re-enable the policy.
- Application Health extension defaults: interval 5 seconds (5 to 60) and 1 probe (1 to 24). Flexible needs the extension for health.
Upgrade policy and model changes
| Mode | Behavior | Fits |
|---|---|---|
| Manual | You decide when existing instances update. New instances use the latest model | Control over timing |
| Automatic | No ordering guarantee; may take all VMs down at once | Dev/test |
| Rolling | Updates in batches with health checks. Flexible needs the Application Health extension | Production |
- Model changes (image reference, SKU, data disk, extensions, zones) apply to new instances automatically. Existing instances are brought up to date by the upgrade policy.
latestModelAppliedshows whether an instance is current. - With a Manual policy, bring existing instances up to date with
az vmss update-instances --instance-ids "*"orUpdate-AzVmssInstance -InstanceId '*'. - Password, SSH key, custom data, image reference, VM size, adding zones and PPG changes need a restart, reimage or redeploy. Password and custom data changes need a reimage.
- The upgrade policy is separate from the automatic OS image upgrades feature (Uniform only).
Attach an existing VM to a Flexible scale set
- Portal: VM > Availability + scaling > Scaling > Get started. CLI:
az vm update -g rg -n vm --set virtualMachineScaleSet.id='<vmssId>'. - Requirements: Flexible mode,
platformFaultDomainCountof 1,singlePlacementGroupfalse, same resource group, VM has managed disks, VM is not in an availability set, not in a PPG, and not on a Dedicated Host. - A zonal VM can attach only to a zonal or zone-spanning scale set in a matching zone. A regional VM can attach only to a regional scale set.
CLI and PowerShell
| 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 |
Exam Tips
Tick each tip once you can answer it without looking.
“Two web VMs must survive a rack power failure and rolling host updates; the region has no availability zones” → Availability set with two or more VMs (fault domains for hardware, update domains for planned maintenance). Trap: one VM in a set doesn't meet the two-VM condition for the 99.95% SLA.
“Put an existing VM into an availability set” → Delete and re-create the VM in the set, keeping its disks. Trap: editing the VM's availability option. A VM can be added to a set only when it's created.
“Change the fault or update domain count of an existing availability set” → Not possible: create a new set and re-create the VMs. Trap: updating the existing set. The counts are fixed at creation.
“Survive the loss of an entire datacenter” → One VM per availability zone behind a load balancer. Trap: an availability set. Its fault domains are still exposed to datacenter-level shared failures.
“Single VM pinned to zone 2, and zone 2 fails” → The VM is down until the zone recovers. Trap: a zonal VM isn't zone-redundant, so it doesn't fail over by itself.
“Portal create VM, Availability zone, zones 1, 2 and 3 selected” → Three VMs, named with the suffixes -1, -2 and -3. Trap: expecting one VM replicated across three zones.
“Existing nonzonal VM must become zonal” → Move it: Azure creates a new VM in the target zone. Trap: planning to undo it later. A zonal VM can't be converted back to nonzonal.
“Scale set must reach a 99.99% SLA” → Spread instances across availability zones. Trap: more fault domains. Spreading across fault domains gives 99.95%.
“Zone-spanning scale set must keep zone counts equal, plus or minus one, even when scaling” → Set zoneBalance to true. Trap: the default, which is best-effort balancing.
“VMs need the lowest network latency, in one datacenter” → Proximity placement group; stop (deallocate) existing VMs before moving them in. Trap: using zones for latency. A single PPG can't span zones.
“Scale set mode that can add existing VMs, use standard VM APIs and Azure Backup” → Flexible orchestration. Trap: Uniform. Its instances aren't compatible with the standard VM APIs, Azure Backup or Site Recovery, and it can't attach existing VMs.
“Change a scale set from Uniform to Flexible” → Not possible: the orchestration mode is set at creation. Trap: updating the scale set. The mode can't be changed later.
“Scale out at CPU above 70% for 10 minutes with a 5-minute cool down” → Autoscale scale-out rule, paired with a scale-in rule (for example CPU below 30%). Trap: a scale-out rule alone. Microsoft says to pair it with a scale-in rule to avoid flapping.
“Two scale-in rules; only one of them is true” → No scale in: all scale-in rules must be true. Trap: assuming OR logic. Only scale out fires on any one rule.
“Autoscale metrics can't be read and the profile default is above current capacity” → Scale out to the default count. Trap: expecting a scale in when current capacity is already above the default. It doesn't scale in.
“Remove the most recently created instance on scale-in” → Scale-in policy NewestVM. Trap: the Default policy. It balances across zones and fault domains, then deletes the highest instance ID.
“One instance runs a long job and autoscale must not remove it” → Protect from scale-in on that instance. Trap: expecting it to stop you deleting the instance, or to block reimage and upgrade. Use protect from scale set actions for those.
“Production scale set must update in batches and keep instances available” → Rolling upgrade policy (Flexible needs the Application Health extension). Trap: Automatic, which may take all VMs down at once. Manual does nothing until you update the instances.
“Manual upgrade policy, image changed on the model, existing instances still old” → Run update-instances (az vmss update-instances --instance-ids "*"). Trap: waiting. Only new instances get the new model on their own.
“Replace unhealthy scale set instances automatically” → Automatic instance repairs with the Application Health extension or a load balancer probe. Trap: configuring both health sources. Repairs use only one at a time.
Sources
- Availability sets overview
- Availability options for Azure Virtual Machines
- What are Azure availability zones
- Reliability in Azure Virtual Machines
- Reliability in Azure Virtual Machine Scale Sets
- Orchestration modes for Virtual Machine Scale Sets
- Availability zone options for scale sets
- Manage fault domains in scale sets
- Proximity placement groups
- Autoscale overview for scale sets
- Autoscale scale sets in the portal
- Autoscale best practices
- Scale-in policies
- Instance protection
- Upgrade policy modes
- Modify a scale set
- Automatic instance repairs
- Application Health extension
- Attach or detach a VM to or from a scale set
- Change a VM's availability set
- az vm availability-set reference
Checked against Microsoft Learn on November 13, 2026.