Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Resource Manager: move VM to availability group

Tags:

azure

Can't seem to figure out how to change the availability set of an existing Azure VM in the Resource Manager stack. There's no interface for it. Set-AzureAvailabilitySet does not exist in the Azure Powershell tools when in ResourceManager mode. It does exist in service stack mode. But that doesn't help me.

like image 265
Jerome Haltom Avatar asked Jul 31 '15 01:07

Jerome Haltom


People also ask

How do I move Azure VM to availability zone?

In the Azure portal, select Virtual machines, and select the VM you want to move into Availability Zones. In Operations, select Disaster recovery. In Configure disaster recovery > Target region, select the target region to which you'll replicate. Ensure this region supports Availability Zones.

How do I move a VM to availability set?

A VM can only be added to an availability set when it is created. To change the availability set, you need to delete and then recreate the virtual machine. This article was last tested on 2/12/2019 using the Azure Cloud Shell and the Az PowerShell module version 1.2. 0.

Can you move Azure VM to another resource group?

Go to the Azure portal to manage the resource group containing the VM to move. Search for and select Resource groups. Choose the resource group containing the VM that you would like to move. At the top of the page for the resource group, select Move and then select Move to another resource group.

When can you move a virtual machine Azure?

Virtual machines in an existing virtual network can be moved to a new subscription only when the virtual network and all of its dependent resources are also moved. Virtual machines created from Marketplace resources with plans attached can't be moved across subscriptions.


2 Answers

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:

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

Source

like image 180
SamirFarhat Avatar answered Nov 15 '22 05:11

SamirFarhat


That feature isn't implemented yet in the ARM stack, that's why you're not seeing the cmdlet...

like image 34
bmoore-msft Avatar answered Nov 15 '22 05:11

bmoore-msft