By default it’s not necessary to have an Availability set for creating a new VM.  But Availability set is necessary if you are going to attach this VM to a load balancer.  We have to set the Availability set at the time of creation of VM.  At this moment it’s not possible to attach an existing VM to an Availability set.  For existing VMs you have create the VM again using the same configuration. That’s the only possible way at this moment. So lets see how to create availability set for azure vm.

We used old AzureRM Network powershell commands to have an Availability set for my newly created VM. Refer only if you still maintain old AzureRM module.

For creating Availability set.

Copy to Clipboard

During creation of VM, we input this Availability set with  “New-AzureRmVMConfig” cmdlet. That’s how we attach VM to Availability set we have.

Copy to Clipboard

If we try to attach a VM doesn’t have any Availability set to an existing load balancer we will get error like below.

 “the new vm is not in the same availability group as the existing vm attached“