locked
Azure ARM: How to add an existing VM to a new Availability Set? RRS feed

  • Question

  • My question is simple, and the solution was also simple in the Azure Classic model. However, in the Azure ARM (Azure Resource Manager) model it is far from that...

    I create an Azure VM using ARM. Later, I create an Availability Set using ARM. How can I add the VM to the availability set? There used to be a specific Powershell CMDlet for this in Azure Classic, but now there is not.

    I noticed a property in the VM configuration called "AvailabilitySetReference", however I have not managed to populate it with the ID of the availability set. 

    Can someone help me with this?

    Thursday, November 5, 2015 12:50 PM

All replies

  • I see you have never gotten an answer for this.  I too am trying to do this and it turns out there is currently no way to do this.  https://github.com/Azure/azure-xplat-cli/issues/1937 is an issue in GitHub that details this issue.  Right now, the only way to do this is to create a new VM an assign the availability set at that time.
    Tuesday, February 16, 2016 2:26 PM
  • Hi

    You can delete the VM (keep the VM disk) and then recreate it by using the VM disk.

    Monday, February 29, 2016 1:50 PM
  • Hi,

    1.Create the restource group.Storage,network,etc. 

    2.You should shutdown the VM in classic portal and copy the VM VHd file to ARM blob storage;

    3.Use the powershell to create the VM in ARM:

    New-AzureRmResourceGroupDeployment -Name "vmname" -ResourceGroupName  "Resource Group Name" -TemplateUri https://xxxxxxxxx

    More information:

    https://msdn.microsoft.com/en-us/library/mt603823.aspx

    • Proposed as answer by Mark Leong Tuesday, March 8, 2016 4:22 PM
    • Unproposed as answer by Mark Leong Tuesday, March 8, 2016 4:22 PM
    Tuesday, March 8, 2016 4:21 PM
  • It's not a Classic VM though.  This won't work.
    Tuesday, March 8, 2016 4:42 PM
  • I am also getting the same problem 
    but now i am trying to solve this issue using this link

    https://gallery.technet.microsoft.com/Set-Azure-Resource-Manager-f7509ec4#content

    Friday, April 8, 2016 9:46 AM
  • Thanks for the script. In fact this is how I had solved it...but I had done it manually instead at the time.


    Friday, April 8, 2016 10:32 AM