Migrate Availability Set to another Azure subscription - addycluri/Azure GitHub Wiki

Migrating Azure Resources to another subscription using Resource Move

If you need to migrate azure resources across different subscriptions, either within the same tenant/Directory or even across tenants, the resource move feature from the Azure portal can be very useful however, it has quite a few limitations based on the type of resources you are trying to migrate.

This wiki particularly focuses on the process of migrating Availability sets with virtual machines with managed disks to another subscription in your efforts to moving Azure resources from EA (Enterprise Agreement) or PAYG (Pay-as-you-go) to CSP (Cloud Solutions Provider)

Migration Steps

Unlike other Azure resources, Migrating Availability sets with virtual machines with managed disks is not straightforward as the disks attached to the VM's must be converted from managed --> unmanaged like mentioned in the Azure Resource Move VM Limitations only after which the av-set can be migrated. Below are the E2E guidance for migrating the av-set from subscription A to subscription B

  • Download and import the Powershell Module locally using the instructions provided - here

  • Open PowerShell and run Get-Help Convert-AVSetManagedToUnManaged -Full to get an understanding of how the function works and the input parameters required.

  • Login to your source azure account using Connect-AzureRmAccount -TenantId "GUID" -SubscriptionId "GUID" (where the managed availability set(s) currently live)

  • Now convert the managed Av-set to un-managed using the commmand - Convert-AvSetManagedToUnManaged -AvailabilitySetName "MY-AVSet" -ResourceGroupName "MY-RG" -verbose. Please be advised that this process requires VM's in the av-set to be turned off so plan accordingly

  • After the successful conversion, the av-set is now un-managed and will support Azure resource move functionality.Please follow the Resource Move steps described here and move the av-set to the target subscription.

  • After the av-set is successfully migrated to the target subscription, you can convert the av-set back to "managed" by following the steps below:

    • Ensure the powershell module downloaded from here is imported into the current Powershell session
    • Login to the target azure account using Connect-AzureRmAccount -TenantId "GUID" -SubscriptionId "GUID" (this is where you migrated the av-set to)
    • Now convert the "un-managed Av-set" back to managed using the commmand - Convert-AvSetUnManagedToManaged -AvailabilitySetName "MY-AVSet" -ResourceGroupName "MY-RG" -verbose. Please be advised that this process requires VM's in the av-set to be turned off so plan accordingly

References

Export VM disk mapping Convert Availability Set from managed to un managed Convert Availability Set from unmanaged to managed