Deploy and Manage Azure Compute Resources · Topic 3 of 5

Availability Options and Scale Sets

AZ-104 availability: availability zones, availability sets with fault and update domains, and Virtual Machine Scale Sets with orchestration modes and autoscale.

  • 5 min
In a nutshell
  • Zones protect against a datacenter loss and give 99.99 percent. Availability sets protect against rack failure and give 99.95 percent.
  • Availability sets use fault domains for hardware and update domains for maintenance.
  • A VM is in a zone or an availability set, not both.

What it is

A single VM is a single point of failure. Azure gives you three ways to spread virtual machines so that a hardware failure or planned maintenance does not take your service down.

Availability zones spread machines across datacenters. Availability sets spread them across racks inside one datacenter. Virtual Machine Scale Sets manage a group of identical machines and change its size automatically.

Availability zonesseparate datacentersAvailability setsracks and update groupsScale setsidentical VMs, autoscale

How it works

Availability zones

An availability zone is a physically separate location inside a region with its own power, cooling and networking. When you create a VM you can choose a zone. Placing machines in two or more zones gives the highest availability commitment for VMs, which is 99.99 percent.

Zones protect against the loss of a datacenter. Not every region offers them.

Availability sets

An availability set spreads VMs across fault domains and update domains inside one datacenter.

  • A fault domain is a group of hardware that shares power and network. VMs in different fault domains survive the failure of one rack.
  • An update domain is a group that is restarted together during planned maintenance. Only one update domain is rebooted at a time.

Two or more VMs in an availability set have a 99.95 percent availability commitment. You choose the set when you create the VM, and a VM cannot be in both an availability set and an availability zone.

Virtual Machine Scale Sets

A scale set deploys and manages a group of identical virtual machines and can add or remove machines as demand changes.

Orchestration modeNotes
FlexibleThe recommended mode. Instances can be spread across zones and fault domains, and can differ in size
UniformAll instances are identical and created from one model

Autoscale

Autoscale changes the instance count by rules.

  • Metric rules scale out or in when a metric, such as average CPU percentage, passes a threshold for a set time.
  • Schedule rules change the count at chosen times, for example more instances on weekdays.
  • You set a minimum, a maximum and a default number of instances.
  • A cool down period after each action stops the set from reacting too quickly.

Scale out adds instances and scale in removes them. A load balancer or application gateway in front of the set spreads the traffic.

az vmss create --resource-group rg-app --name vmss-web --image Ubuntu2204 --instance-count 2 --admin-username azureuser --generate-ssh-keys
MetricCPU above 70 percentAutoscale rulescale out by 1Instance countrises to the maximum

Choosing an availability option

The requirementChoice
Survive the loss of a datacenterAvailability zones
Survive a rack failure and planned maintenance in one datacenterAn availability set
Run many identical VMs and change the count automaticallyA scale set with autoscale
Highest availability for VMsTwo or more VMs across zones

Updating the instances of a scale set

For a Uniform scale set, the upgrade policy says how a new image or configuration reaches the instances.

PolicyBehaviour
ManualNothing changes until you update instances yourself
AutomaticInstances are updated automatically, with no control of order
RollingInstances are updated in batches, so the service stays up

Health and automatic repair

A scale set can watch the health of each instance, with an application health extension or a load balancer probe. When automatic instance repair is turned on, an unhealthy instance is deleted and replaced. This keeps the capacity you asked for without manual work.

A worked scenario

A web tier must stay up through a datacenter failure and grow on weekday mornings. Use a Flexible scale set spread across zones, behind a load balancer. Add a metric rule that scales out at a high CPU level, a schedule rule that raises the minimum on weekdays, and a maximum count that caps the cost.

How the exam asks about this

  • "99.99 percent availability for VMs." Two or more VMs across availability zones.
  • "99.95 percent availability for VMs." Two or more VMs in an availability set.
  • "Update instances in batches." A rolling upgrade policy.
  • "Add instances when CPU is high." A metric based autoscale rule.

What to remember for the exam

  • Zones protect against a datacenter loss and give 99.99 percent. Availability sets protect against rack failure and give 99.95 percent.
  • Availability sets use fault domains for hardware and update domains for maintenance.
  • A VM is in a zone or an availability set, not both.
  • Scale sets are Flexible or Uniform. Flexible is recommended.
  • Autoscale uses metric or schedule rules with a minimum, maximum and default count.
  • Scale out adds instances, scale in removes them. Cool down prevents flapping.
Exam tip

"Survive the loss of a whole datacenter" points to zones. "Survive a rack failure or maintenance reboot" points to an availability set.

Common mistakes

Putting a VM in a set and a zone. It can be only one.

Using one VM in an availability set. The commitment needs two or more machines.

Confusing scale up with scale out. Up changes the size of one machine. Out changes how many machines.

Setting no maximum. A runaway rule can add far more instances than intended.

Check yourself

  • Which option protects VMs from the loss of a datacenter?

    Availability zones.

  • What is a fault domain?

    A group of hardware that shares power and network, so VMs in different ones survive a rack failure.

  • What three counts do you set for a scale set autoscale profile?

    Minimum, maximum and default instance counts.

Topic 3 of 5 in Deploy and Manage Azure Compute Resources

Test yourself on Deploy and Manage Azure Compute Resources

The full Microsoft AZ-104 question bank has 650 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Microsoft. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.