Whenever someone starts architecting Azure Infrastructure they jump on Virtual Machines and start provisioning workloads for Azure VM.
I must tell you before you plan your Virtual Machines in Azure, you must plan a couple of things such as Virtual Network, Availability Set, Managed Disks, Desired State Configuration, Deployment approach, Regional and High availability set, load balancers, traffic managers, Application Gateway, VPN and express routes and so many things.
In this article, I will talk about a very small but very important concept: Availability Set with Fault Domains and Update Domains.
Availability Set
- Availability Sets ensure that the Azure virtual machines are deployed across multiple isolated hardware nodes in a cluster.
- By deploying your VMs across multiple hardware nodes Azure ensures that if hardware or software failure happens within Azure, only a subset of your virtual machines are impacted and your overall solution is safe and in working condition.
- Availability set provides redundancy for your virtual machines.
- Availability set spreads your virtual machines across multiple fault domains and update domains.
- If you want to leverage Microsoft’s 99.95% SLA from Microsoft you must place your VMs inside the availability set except your VMs have premium storage.
Following are the 3 main scenarios that can cause your VMs in Azure to be impacted or put them in a faulted state.
- Unplanned Hardware Maintainance Events: When the Azure platform predicts that the hardware or any platform components associated with a physical machine are about to fail.
- An unexpected downtime: rarely occurs
- Planned Maintenance events: periodic updates made by Microsoft.
After both planned and unplanned updates your virtual machines and your operating system will be rebooted.
Each virtual machine in the Availability Set is assigned an Update domain and Fault domain by the Azure platform.
Fault Domain
- Fault domains define the group of virtual machines that share a common power source and network switch.
- Each and every fault domain contains some racks and each rack contains virtual machine.
- Each of these Fault domains shares a power supply and a network switch.
- If there is a failure in the fault domain then all the resources in the fault domain become unavailable.
- You should place your vms such a way that each fault domain get one web server, one database server, and like that.
Consider the below-mentioned diagram below.
Here we have arranged the web server VM and database server vm in such a way that if one Fault Domain fails, still your vms would be available.
Update Domains
- Virtual machines get updated domains automatically once they are put inside the availability set.
- All virtual machines within that update domain will reboot together.
- Update domains are used for patching of the virtual machines.
- Only one update domain would be updated at the time.
How many Fault Domains and How many Update Domains we can have?
- In the Azure Service Management (ASM) portal, we have two Fault domains and 5 update domains.
- In the Azure Resource Manager(ARM) portal, we have three Fault domains and 5 update domains but we can upgrade our update domains from 5 to 20.
- VMs are assigned sequentially in the update domains and fault domains.
- Consider the below mentioned table to understand how virtual machines would be placed within Fault Domains and Update Domains inside an availability set.
Virtual Machines |
Fault Domain (3 Fault doamins) |
Update Domain (5 Update domains) |
VM 1 |
0 |
0 |
VM 2 |
1 |
1 |
VM 3 |
2 |
2 |
VM 4 |
0 |
3 |
VM 5 |
1 |
4 |
Key Points to remember
- You need to create virtual machines in the same resource group as the availability set.
- One virtual machine can only be in one available set.
- You can assign virtual machines to the availability set only during the creation of virtual machines.
- You should create separate storage accounts for each virtual machine.