Azure Availability Sets


What is an Availability Set?

Availability Sets make use of two key concepts - Fault Domains, and Update Domains. At its core, Azure consists of racks upon racks of servers. Each rack can host any number of virtual machines. When creating a highly available pairing, you want to be sure that there is no single point of failure, that your workload will still be provisioned by one virtual machine if the other is under maintenance. Unfortunately, if you do not specify otherwise, there is no guarantee that your VMs will not be placed on the same rack, or the same 'Fault Domain'. In essence, a fault domain can be considered a rack within Azure. Every VM on the rack is subject to that rack's power and network connections. A rackwide failure, or a rackwide maintenance window will take down all VMs hosted on this single point of failure. When Azure refers to a fault domain, consider each fault domain a single point of failure.
An Availability Set distributes highly available workloads across multiple Fault Domains, thereby eliminating any single point of failure. Unless the entire data center is down, your workload will keep running. In essence, your workload is split between two or more racks, leveraging the redundant power supplies, network switches, etc, of each.
Grouping VMs in an availability sets also gives the Windows Azure Fabric Controller (FC) the information it needs to intelligently update the host OSs that your guest VMs are running on. Without availability sets the FC would have no idea that two machines were serving the same purpose and could reasonable take them both down for host OS updates.
An Availability Set also makes use of Update Domains. This allow you to determine how many of the workloads are down at any given time. You can set a priority order for shutting down the VMs and the number of update domains determines how many machines will be involved in the shutdown. In the image below, we see an Availability Set with 16  virtual machines, and four update domains. This means that a maximum of four VMs  can be down for maintenance at a given time, allowing the other 12 to carry the load. Once the first four return to service, another group will be available for maintenance. In conjunction with Fault Domains, this allows an Availability Set to ensure that undue burden is not placed on either rack.
When considering your use case, including the number of VMs you want to create and the number of Availability Sets you will need to create, remember that as a rule, you want one Availability Set per workload. A workload can be considered any virtual machines working together towards a common single purpose. Therefore, two highly available SoftNAS VMs to perform a single function would constitute a workload.

Creating An Availability Set

Creating an Availability Set in the Azure Portal can be done in one of two ways - while creating your VM, or separately.
Creating Separately
To create an Availability Set prior to creating your virtual machines, select More Services, then Availability Sets from the listed options.
Click Add.
Provide a name, the subscription that the Availability Set belongs to, the number of Fault Domains and Update Domains you require for your particular purpose, and create or select an existing resource group. Finally, select a location.
During VM creation
If creating a VM, it is possible to select an existing Availability Set, or to create one for your instance. When adding your virtual machine within an Availability set, or creating one, remember that for a given workload, both must be in the same Availability Set. A virtual machine cannot be moved from one availability set to another after creation.
Creating your virtual machine is well documented in Create and Configure a Virtual Machine in Azure, so we will not cover the topic in detail. It is in the third part of VM creation, Settings, in which your Availability Set can be created or selected.
Once Availability Set has been selected, you will have the option to create a new Availability Set, or select from existing if available within the current resource group and location. To create a new Availability Set, click Create New.
Note that the menu here is much simplified, as your resource group and location were already determined when establishing the 'Basics' for your VM.  These settings are automatically applied to your Availability Set using this method.
If a pre-existing Availability Set is available, simply select it, and it will be applied to your VM.
Remember again, if you create or add an availability set to the first VM of your HA pairing, the second must be added to the same availability set.