Using Powershell to create Azure VMs in an Availability Set
Azure futures Availability Sets. Workloads placed in an Availability Set are placed in different Fault and Upgrade domains. A Fault domain is a group of Azure resources that are subject to concurrent failure. For example, servers connected to a switch may be in the same Fault domain since switch unplanned failure will disrupt access to that group of servers. An Upgrade domain is a group of Azure resources that are subject to planned down-time as Microsoft performs routine maintenance and upgrades. By placing 2 VMs for example in an Availability Set, Microsoft ensures that they’re placed in different Upgrade and Fault domains. So, in case of unplanned failure or planned upgrade, one of the VMs is always up.
This script is a demo/test of an Availability Set done after the VMs have been provisioned. Adding/removing VM from Availability Set cause the VM to reboot.
The script output may look like:
At the bottom you can see that the 2 VMs are in different Upgrade and Fault Domains. The Azure Management Interface also reflects the changes performed by the script:
The Availability Set details can also be seen in the Azure Management Interface under the Cloud Service\Instances page:
This script is a demo/test of setting up an Availability Set at the time of VM creation. Output may look like: