This post second installments of Azure 101. I posted about affinity groups a while ago to explain how do We control location of cloud services. Understanding availability sets is very important if We care about high availability of the VMs.
Increasing high availability
Availability sets is the way Azure control the physical host location of VMs, so they will be provisioned on different rack in Azure data center. If two VMs were created without specifying availability sets, there is no guarantee that they will be located in different rack. In the case of planned maintenance or rack failure, all of them will be offline.
Grouping multiple VMs in the same availability sets ensures that they will be distributed to different power and network sources. This means If one of them unavailable the one in another rack is still fine. This also ensures the configuration meets 99.95 Azure SLA as stated here.
The following diagram depicts multiple VMs in different rack for the purpose of SQL Server Availability Group cluster.
As outlined in the diagram, each VM connected to different power and network sources. This increases their availability in either planned or unplanned downtime. Multiple VMs with the same purpose should be located in the same availability sets to provide high availability or redundancy, for example:
- Configuring multiple VMs to create node in SQL Server AlwaysOn Availability Groups or Failover Cluster Instance
- Providing load balancing between VMs to hosts various services such as IIS or file server
Creating Availability Set
There are several way to create availability set. The easiest one is by defining its name during VM creation. Make sure to choose From Gallery so the following window will appear:
Once multiple VMs in the same availability sets are created, they will appear under the same set as follow:
In the case the VM has been created but it does not belong to any availability sets, the following PowerShell command will update the VM to join availability set:
Get-AzureVM -ServiceName "theNameofVMsCloudService" -Name "VMNamehere" | Set-AzureAvailabilitySet -AvailabilitySetName "nameofAvailabilitySet" | Update-AzureVM
Updating VM’s availability sets causes reboot, so plan accordingly.