Steps to add existing VM into High Availability Set

Steps to add existing VM into High Availability Set

In this blog, we will show you the Steps to add existing VM into High Availability set using Microsoft Azure Portal.

 

REQUIREMENTS

  • Azure Subscription
  • Azure VM

 

ENVIRONMENT OVERVIEW

  • We have already created a new vm named az-ha-vm-01 and a new availability set named VM-High-Availability-Set.

Steps to add existing VM into High Availability Set

 

Steps to add existing VM into High Availability Set

 

  • You can able to configure the high availability set only during VM creation.
  • To confirm that, access the VM properties of a VM in the Azure portal and click on availability set. You will see the below information.

Steps to add existing VM into High Availability Set

 

  • So, we are adding the existing VM to an availability set using PowerShell script.

 

DOWNLOAD VM HIGH AVAILABILITY SET

Steps to add existing VM into High Availability Set

 

  • Download the Set-ARmVmAvailabilitySet.ps1 script to your local machine.

Steps to add existing VM into High Availability Set

 

  • We have downloaded under c:\scripts folder for this demo.

Steps to add existing VM into High Availability Set

 

RUNNING THE POWERSHELL SCRIPT

  • Open the PowerShell window and execute the below command.

Syntax: Set-ArmVmAvailabilitySet.ps1 -VmName <Name of the VM> -ResourceGroup <Resourcegroup name> -AvailabilitySetName <Provide the high availability name>

Example:  Set-ArmVmAvailabilitySet.ps1 -VmName az-ha-vm-01 -ResourceGroup az-resourcegroup -AvailabilitySetName VM-High-Availability-Set

Steps to add existing VM into High Availability Set

 

  • It will prompt for azure login credentials.

Steps to add existing VM into High Availability Set

 

  • Then it will prompt us to select the Azure subscription.

Steps to add existing VM into High Availability Set

 

  • It will validate the VM and availability set details.

Steps to add existing VM into High Availability Set

 

  • This script will destroy the existing VM and create an identical one with same name and its settings. This is the workaround for this limitation as of now.

Steps to add existing VM into High Availability Set

 

VERIFICATION

  • Log in to Azure portal and select availability set from the service list.

Steps to add existing VM into High Availability Set

 

  • Click on the availability set name.

Steps to add existing VM into High Availability Set

 

  • You can see one virtual machine has been added to this availability set.

Steps to add existing VM into High Availability Set

 

VIDEO

Thanks for reading this blog. We hope it was useful for you to learn the workaround steps to add the existing VM into an availability set.



Author: Loges
Logeswaran holds Microsoft certified engineer & solution architect certifications with over 11+ years of experience in the fields of hosting technologies and IMS/Cloud consulting. At AssistanZ, Logeswaran spearheads the strategic planning and execution of the company’s Microsoft based core technologies to Enterprise clients.

3 Comments

  • Bill Sklavenitis

    Hi Loges,
    Thank you for this article/post. It worked a treat..
    We had 2 Test Failover servers that needed to be in a availability set for the Load Balancer to add them into Backend pools.
    Cheers and thanks again.
    Bill

  • Hi Bill,

    Thanks for your comments 🙂

  • Nam Truong

    Hi Loges,

    Thank you for your helpful article.
    One question is how about the data existing on the VM after adding to Availability Set?
    Does the data get cleared or still keeping?
    I already joined to domain, installed some of my applications into the VM and do not want to loose them.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.