How do you set an availability set for an existing VM in azure?
Solution 1
There is no setting for this in ARM yet, even in powershell
Solution 2
Well there is still no option in the GUI, but Samir Farhat has written a powershell script which can be used to change the AS of existing VM in ARM mode.
AFAIK, this feature may be addressed by the end of this year. It's a big challenge for the MS team to allow such operation. Changing the availability Set requires a review of the VM mobility architecture on Azure. Fore example, adding a VM in an Availability Set already containing a VM means putting it to different default domain. Becasue VM mobilty is a matter on Azure (No Live Migration), it's not an easy operation. I have written a Powershell script which let you change the AS of an ARM VM by recreating it. Give it a try and enjoy : https://buildwindows.wordpress.com/2016/02/25/add-or-change-an-arm-virtual-machines-availability-set/
The complete discussion on this topic can be found at this link
Copying the excerpt here, Just in case if the page link becomes invalid
How to use it ?
1- Download the script and save it to local location
2- Run it and provide the requested parameters
or
2- ./Set-ArmVmAvailabilitySet.ps1 –VmName ‘The VM Name’ –ResourceGroup ‘Resource Group’ –AvailabilitySetName ‘As Name’ –SubscriptionName ‘The Subscription name’
To remove a VM from an AvailabilitySet:
./Set-ArmVmAvailabilitySet.ps1 –VmName ‘The VM Name’ –ResourceGroup ‘Resource Group’ –AvailabilitySetName 0 –SubscriptionName ‘The Subscription name’
Download Link
Version 1.01 : https://gallery.technet.microsoft.com/Set-Azure-Resource-Manager-f7509ec4
Related videos on Youtube
Dreamwalker
Updated on September 18, 2022Comments
-
Dreamwalker over 1 year
I am using the new Resource Manager type of virtual machine.
Now I need to add this into a load balancer (already configured) but I can't find how to assign this VM into the Availability Set so I can allocate it to the load balancer.
There seems to be no UI in the preview portal, so I am assuming this to be a PowerShell only at the moment but I can find no docs on assigning an existing VM.
FYI - All items associated with this are in the same region I ensured this to start with.
-
Viresh Mathapati about 8 yearsI tried this link and successfully added existing ARM VM into availability set. but it will deallocate your existing VM creates new VM with same configuration from existing image. Try this link blog.e-zest.net/…
-
-
Juha Palomäki over 8 yearsJust got a confirmation for this from support. The functionality is not yet there, but should be coming.
-
Dreamwalker over 8 yearsWell at least I wasn't going mad. In the end I recreated the VM and attached the previously created drive.
-
cjones26 about 8 yearsStill not possible from the GUI?