Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Lesson 25 of 47
❮Prev Next❯

Availability Zones, Availability Sets and VM Scale Sets

Module 3: Compute ⏱ 12 min read Updated

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    30-second answer

    An availability set spreads VMs across fault domains (racks with their own power and network, up to 3) and update domains (rebooted one at a time, up to 20) inside one datacenter: 99.95% SLA with two or more VMs. Availability zones put VMs in separate datacenters in a region: 99.99%. A VM uses one or the other and you choose at creation. A Virtual Machine Scale Set runs identical VMs (use Flexible orchestration) across zones or fault domains, and autoscale rules add or remove instances on metrics such as Percentage CPU, between a minimum and maximum.

    Simulate it » No Azure account needed

    Exam objective: 3.2.6 Deploy virtual machines to availability zones and availability sets. 3.2.7 Deploy and configure an Azure Virtual Machine Scale Sets. (Skills measured as of April 17, 2026)

    Simulations

    Feel it before you read it. No account needed, nothing leaves this page.

    Azure portal: Zones, availability sets and a Flexible scale set with autoscale Pick zones or a set, then build a scale set with autoscale.
    </> Embed

    Embed this simulation

    Free for trainers, teachers and bloggers. Paste this into your page:

    Loading the portal…

    In <strong>Create a virtual machine › Basics</strong>, <strong>Availability options</strong> decides how the VM survives failures. <strong>Availability zone</strong> with zones <strong>1, 2, 3</strong> creates three VMs, one per datacenter: 99.99% SLA.

    👆 Click the glowing item in the portal to continue

    Read the steps as text
    1. In Create a virtual machine › Basics, Availability options decides how the VM survives failures. Availability zone with zones 1, 2, 3 creates three VMs, one per datacenter: 99.99% SLA.
    2. Pick Availability set instead and the VM is spread across fault domains (racks) and update domains (maintenance groups) in one datacenter: 99.95% with two or more VMs. You choose this at creation; an existing VM can't join a set later.
    3. For identical VMs that grow and shrink, open Virtual machine scale sets and select + Create.
    4. Flexible orchestration is the recommended mode: instances spread across zones 1, 2, 3 and you can mix sizes. Set Scaling mode to Autoscaling and open the configuration.
    5. The default condition: keep 3 to 10 instances, add one when average CPU is above the scale-out threshold, remove one when it's below the scale-in threshold. The scale-in policy picks which instance goes first.
    6. The scale set is created with three instances, one per zone.
    7. On Instances, one VM landed in each zone. Now open Scaling.
    8. Custom autoscale holds the rules (Azure Monitor autoscale). When CPU crossed 70% the set grew by 2, then shrank as it cooled. CLI: az monitor autoscale create and az monitor autoscale rule create.

    🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.

    😟 THE PROBLEM

    One rack failure took the whole web tier offline.

    😊 THE SOLUTION

    Spread VMs across fault domains or zones and let a scale set add instances on demand.

    • All VMs in one rack✓ Fault domains
    • Datacenter outage✓ Availability zones
    • Busy afternoons✓ Autoscale rules
    🛠️ Solved with: Availability sets, zones and scale sets

    Start with a question

    Why do airlines put the pilot and co-pilot on different meals?

    If both pilots eat the same fish and it’s bad, nobody flies the plane. So they eat different meals. One bad meal can’t take out both.

    Azure does the same with your VMs. An availability set keeps them on different racks, so one power failure can’t take out both. Availability zones keep them in different buildings. And a scale set brings in extra crew when the plane gets busy.

    Explain it like I’m 10

    The technical explanation

    Pick an availability option

    OptionProtects againstSLA (VM connectivity)Set when
    Single VM, Premium SSD or better on all disksLittle: one host99.9%Any time
    Availability setRack failure, host maintenance99.95% (2+ VMs)VM creation only
    Availability zonesA whole datacenter failing99.99% (2+ VMs in 2+ zones)VM creation only
    Scale set (zones or fault domains)Same as the spread it uses, plus loadSame as aboveCreation; instances added any time

    In the create wizard, Basics › Availability options offers No infrastructure redundancy required, Availability zone, Virtual machine scale set and Availability set. Selecting several zones creates one VM per zone.

    Availability sets

    An availability set spreads its VMs across fault domains (up to 3, region-dependent, default 2) and update domains (default 5, up to 20). VM 1 lands in FD0/UD0, VM 2 in FD1/UD1, and so on. The set is free; you pay for the VMs. A VM joins a set only when it’s created, and a VM can’t be in a set and a zone.

    az vm availability-set create -g rg-contoso-prod -n avset-web \
      --platform-fault-domain-count 2 --platform-update-domain-count 5
    az vm create -g rg-contoso-prod -n vm-web-01 --image Ubuntu2404 --availability-set avset-web --generate-ssh-keys
    New-AzAvailabilitySet -ResourceGroupName rg-contoso-prod -Name avset-web -Location eastus `
      -PlatformFaultDomainCount 2 -PlatformUpdateDomainCount 5 -Sku Aligned

    The Aligned SKU is needed for managed disks, so each VM’s disks sit in the same fault domain as the VM.

    Availability zones

    az vm create -g rg-contoso-prod -n vm-api-z1 --image Ubuntu2404 --zone 1 --generate-ssh-keys
    az vm create -g rg-contoso-prod -n vm-api-z2 --image Ubuntu2404 --zone 2 --generate-ssh-keys

    Zone numbers are per subscription, so your zone 1 may not be another subscription’s zone 1. Use zone-redundant (Standard SKU) public IPs and load balancers so the front door survives a zone too.

    Virtual Machine Scale Sets

    A scale set runs identical VMs and can grow and shrink. Flexible orchestration is the recommended mode: instances are normal VMs, sizes can be mixed and instances spread across zones or fault domains. Uniform is the older mode for large fleets of identical instances, with an upgrade policy (Manual, Automatic or Rolling) for model changes.

    az vmss create -g rg-contoso-prod -n vmss-web --image Ubuntu2404 \
      --orchestration-mode Flexible --zones 1 2 3 --instance-count 3 --vm-sku Standard_B2s --generate-ssh-keys

    Autoscale (Azure Monitor) holds a default instance count, a minimum and a maximum, and rules. Portal: scale set › Scaling › Custom autoscale. CLI:

    az monitor autoscale create -g rg-contoso-prod --resource vmss-web \
      --resource-type Microsoft.Compute/virtualMachineScaleSets --name as-vmss-web \
      --min-count 3 --max-count 10 --count 3
    az monitor autoscale rule create -g rg-contoso-prod --autoscale-name as-vmss-web \
      --condition "Percentage CPU > 70 avg 5m" --scale out 2
    az monitor autoscale rule create -g rg-contoso-prod --autoscale-name as-vmss-web \
      --condition "Percentage CPU < 30 avg 5m" --scale in 1

    Rules have a cool down (5 minutes by default) so the set doesn’t react again before new instances settle. Always pair a scale-out rule with a scale-in rule, or the extra instances never leave. You can also add schedule-based profiles (“10 instances on weekdays 8 AM to 6 PM”) and a scale-in policy (Default, NewestVM or OldestVM). Manual scaling is az vmss scale --new-capacity 5.

    Architect level Counting instances in an autoscale question

    Say min 2, max 6, default 2, scale out by 2 when CPU is above 70% for 10 minutes, scale in by 1 below 30%, cool down 5 minutes. CPU sits at 85% for 30 minutes: the set goes 2 → 4, waits out the cool down, checks again, goes 4 → 6, then stops at the maximum. When CPU drops to 20%, it removes one at a time, each after a cool down, down to 2. If both a scale-out and a scale-in rule match at once, autoscale scales out, because availability wins over cost.

    Real-world business scenario

    Media streaming

    Litware Media (fictional)

    The problem
    The web tier ran on four VMs in one rack. A switch failure took the site down for an hour, and Friday-night traffic doubled the CPU while weekday mornings sat idle.
    What they used
    A Flexible scale set across zones 1, 2 and 3 with a zone-redundant load balancer, autoscale from 3 to 12 instances (+2 above 70% CPU, -1 below 30%), and a schedule profile that starts at 6 instances every Friday at 6 PM. The two licensing servers that can't scale went into an availability set.
    Why that choice
    Zones protect against a datacenter failure, autoscale matches instances to load, and the availability set keeps the two fixed servers on different racks and update domains.
    The result
    The site rode through a later zone incident with no outage, and compute cost fell by about a third because quiet hours run only three instances.

    When to use it and when not to

    ✓ Use it when…

    • Availability zones for production VMs that must survive a datacenter outage.
    • Availability sets in regions without zones, or for apps that need very low latency in one datacenter.
    • Scale sets with autoscale for stateless tiers whose load changes.

    ✕ Think twice when…

    • A single VM for anything with an uptime target. Two is the minimum for these SLAs.
    • Autoscaling stateful servers that keep data on the instance.

    ↔ Alternatives to consider

    • App Service or Container Apps for web workloads that scale without VM management.
    • Azure Site Recovery for protection against a whole region failing.
    • Proximity placement groups when VMs must sit physically close for low latency.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    Test yourself with exercises

    5 original practice questions in the AZ-104 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.

    Question 1

    Question 1 of 5

    You need to deploy two virtual machines so that the application remains available if an entire datacenter in the Azure region fails. What should you use?

    Question 2

    Question 2 of 5

    VM1 was created without an availability set. You need VM1 to be part of an existing availability set named AS1.

    What should you do?

    Question 3

    Question 3 of 5

    You create an availability set with three fault domains and five update domains, and then deploy six VMs to it. During planned maintenance, what is the maximum number of VMs that are rebooted at the same time?

    Question 4

    Question 4 of 5

    You deploy a Virtual Machine Scale Set with autoscale. The minimum is 2, the maximum is 6, and the default is 2. A rule increases the count by 2 when average CPU is greater than 70 percent. CPU stays above 90 percent for one hour.

    How many instances are running at the end of the hour?

    Question 5

    Question 5 of 5 · Select 2

    You need to deploy a Virtual Machine Scale Set that spreads instances across availability zones 1, 2, and 3 and adds instances when average CPU usage is high.

    Which two commands should you run? Each correct answer presents part of the solution.

    Interview preparation

    Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.

    Beginner What's the difference between a fault domain and an update domain?

    Model answer

    A fault domain is about unplanned failures: VMs in different fault domains don't share a rack's power or switch. An update domain is about planned maintenance: Azure reboots one update domain at a time, so not all VMs go down together.

    Intermediate Can you add an existing VM to an availability set or move it into a zone?

    Model answer

    Not by editing it. Both are chosen when the VM is created. To change them you recreate the VM from its disks with the set or zone selected, or use a zone move tool. And one VM can't be in an availability set and a zone at the same time.

    Experienced developer Why would you choose a Flexible scale set over Uniform?

    Model answer

    Flexible is the recommended mode for new deployments. Instances are normal VMs you can manage with the usual VM commands, you can mix sizes and Spot with regular VMs, and it spreads across zones and fault domains for availability. Uniform suits huge fleets of identical instances and some older features, but most new work starts with Flexible.

    Scenario Your web tier must survive a datacenter outage and handle Monday-morning peaks. What would you build?

    Model answer

    A Flexible scale set across zones 1, 2 and 3 behind a zone-redundant load balancer, with autoscale on average CPU, say plus two instances above 70% and minus one below 30%, minimum three so there's one per zone. I might add a scheduled profile to scale out before Monday 8 AM.

    Quick revision

    Key points

    • Availability set - fault domains (up to 3) and update domains (default 5, up to 20) in one datacenter, 99.95%.
    • Availability zones - separate datacenters in a region, 99.99% with VMs in two or more zones.
    • Single VM with Premium SSD or better on all disks - 99.9%.
    • Set and zone are chosen at creation; one VM can't use both.
    • Scale sets - Flexible orchestration, zones, autoscale with min, max, default, scale-out and scale-in rules.

    Important terminology

    Availability set
    A logical grouping that spreads VMs across fault domains and update domains in one datacenter.
    Fault domain
    A group of hardware that shares power and a network switch, like a rack. Up to 3 per availability set.
    Update domain
    A group of VMs that Azure reboots together during planned maintenance. 5 by default, up to 20.
    Availability zone
    A physically separate datacenter (or group of them) within a region, with its own power, cooling and networking.
    Virtual Machine Scale Set
    A group of VMs managed together that can scale out and in automatically.
    Flexible orchestration
    The recommended scale set mode. Instances are standard VMs, can mix sizes and are spread across zones or fault domains.
    Autoscale
    Azure Monitor rules that change the instance count based on metrics or a schedule, within minimum and maximum limits.
    Scale-in policy
    The rule that decides which instance is removed first when a scale set scales in.

    Common mistakes

    • Thinking an availability set protects against a whole datacenter failing.
    • Creating a scale-out rule without a scale-in rule.

    Exam tips

    • "Survive a datacenter failure" = availability zones.
    • "Survive a rack failure or host maintenance" = availability set.
    • "Add VMs automatically when CPU is high" = scale set with autoscale.

    Five quick revision questions

    1. 1.What is the maximum number of fault domains in an availability set?Show

      3 (depends on the region).

    2. 2.What is the default number of update domains?Show

      5.

    3. 3.What SLA do two or more VMs across availability zones get?Show

      99.99%.

    4. 4.Which scale set orchestration mode is recommended for new deployments?Show

      Flexible.

    5. 5.Which command creates an autoscale setting for a scale set?Show

      az monitor autoscale create.

    Official references

    Finished this lesson? Tick it off. Your progress is saved in this browser.

    Next up: Azure Container Registry and Container Instances for Admins

    Studying with a friend? Send them this lesson

    It's free and needs no sign-up. Their progress saves in their own browser.

    Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

    One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.