Azure Cloud Services Migration from ASM TO ARM
Recently I was consulting for an Enterprise customer that wanted to move a number of their resources from Classic to Resource manager portal.
This is the migration path & step by step process that I followed
My previous post that explains the step by step process
Mircosoft link that has some steps missing
Important Note
An important idea is to take a note that in ASM, you could create a cloud service and have 1 or 2 VM / endpoint but the VM wasn’t necessary to be part of a VNET. However, in ARM, when you have a cloud service as an IAAS as in when you have a cloud service that is attached to a VM, that VM must be attached to a VNET.
You can migrate a cloud service and VM from ASM to ARM only within the same subscription under the same region. If you want to move the cloud service & VM to a different subscription then what you have to do is called a VHD move which is copying the VHD from ASM, creating a new VM in ARM and attach the newly created VM to the copied VHD from ASM.
To move a cloud service from ASM to ARM, follow the below command,
First get a list of cloud services by supplying below command
Get-AzureService | ft Servicename
Now build your command by supplying the below in powershell
$serviceName = "My Service"
$deployment = Get-AzureDeployment -ServiceName $serviceName
$deploymentName = $deployment.DeploymentName
Now you have 2 option for Migration, described below, read carefully
Option 1. Migrate the VMs to a platform-created virtual network (Remember that the VM must be attached to a VNET, that is why its creating a platform created VNET)
First validate if the cloud service can be migrated using the below command
$validate = Move-AzureService -Validate -ServiceName $serviceName -DeploymentName $deploymentName -CreateNewVirtualNetwork
$validate.ValidationMessagesIf you receive any error message or warning it maybe either for BGinfo or azure security or backup issues, please follow my previous posts for remediation to those issues.
Otherwise if validation passes then supply below command to progress to prepare stage
Move-AzureService -Prepare -ServiceName $serviceName-DeploymentName $deploymentName -CreateNewVirtualNetworkIf validation passes ok then prepare should also pass ok. it prepare fails, then you can abort move by supplying the abort command as below
Move-AzureService -Abort -ServiceName $serviceName -DeploymentName $deploymentNameOtherwise commit the move by supplying the below command
Move-AzureService -Commit -ServiceName $serviceName -DeploymentName $deploymentNameOption 2. Migrate to an existing virtual network in the Resource Manager deployment model (remember you can only move to an existing virtual network within the same region, if the region where you migrating to, doesn’t have a vNET then you will need to fall back to option 1)
Assuming that you have an existing vnet then follow the below commands ( get the existing resourcegroup and vnet name and the subnet name where you are moving the cloud service / vm to)
-
$existingVnetRGName = "myResourceGroup" $vnetName = "myVirtualNetwork" $subnetName = "mySubNet"
Now validate the migration using the below command
$validate = Move-AzureService -Validate -ServiceName $serviceName-DeploymentName $deploymentName -UseExistingVirtualNetwork -VirtualNetworkResourceGroupName $existingVnetRGName -VirtualNetworkName $vnetName -SubnetName $subnetName$validate.ValidationMessagesIf validation fails then work through the error message otherwise progress to prepare stage by supplying the following command
Move-AzureService -Prepare -ServiceName $serviceName -DeploymentName $deploymentName-UseExistingVirtualNetwork -VirtualNetworkResourceGroupName $existingVnetRGName-VirtualNetworkName $vnetName -SubnetName $subnetNameIf the prepare fails then abort using the abort command otherwise move to prepare by supplying the below command
$vmName = "myVM" $vm = Get-AzureVM -ServiceName $serviceName -Name $vmName $vm.VM.MigrationStateNow commit supplying the below command
Move-AzureService -Commit -ServiceName $serviceName -DeploymentName $deploymentNameFeel free to check my previous post that talks about VNET Migration
-




Leave a Reply