If you were an early adopter of Microsoft Azure’s cloud computing infrastructure, you are probably well aware that Microsoft is no longer updating their “classic” Azure Service Manager (ASM) portal. While Microsoft is working on tools to migrate from ASM to ARM; there are many businesses that will find themselves in an unsupported migration scenario. For those wondering, migrating a cloud service web or worker roles through PowerShell is not possible. I reached out to Microsoft and their direct response was:
PaaS Cloud Services doesn’t have a v2 version and there are no plans to migrate PaaS cloud services to v2 so customers will need to continue using the v1 services as they have.
Below is a guide that walks through the steps required to migrate two web server virtual machines which are load balanced inside a cloud service and is part of an availability set. If you have anything less, it will still work as long as there are no web or worker roles attached to the same virtual network.
Disclaimer: Please keep in mind the guide below will cause irreversible changes and is provided “AS IS”. It is highly recommended you understand what you’re doing and should do a migration in a test environment prior to doing this in production. Celedon Partners cannot and does not assume any responsibility or liability for any way this information is used.
Step 1 – Launch your Powershell ISE and prepare
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#Add your Azure Resource Manager (ARM) account to the session Login–AzureRmAccount #Get a list of available Azure subscriptions Get–AzureRmSubscription #Select the subscription ID you want to use for this session Select–AzureRmSubscription –SubscriptionId #Register the migration resource provider, when you run this command #it will most likely say “RegistrationState : Registering.” Wait 5 minutes #and run the command again, we are waiting for it to say “RegistrationState: Registered” Register–AzureRmResourceProvider –ProviderNamespace Microsoft.ClassicInfrastructureMigrate #Add your Azure Service Manager (ASM) account to the session Add–AzureAccount #Get a list of available Azure subscriptions Get–AzureSubscription #Select the subscription ID you want to use for this session Select–AzureSubscription –SubscriptionId |
Step 2 – Create a new virtual network and migrate the VMs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#Set your variables for the migration (include quotations for the cloud service name) $serviceName = $deployment = Get–AzureDeployment –ServiceName $serviceName $deploymentName = $deployment.DeploymentName #Run validation on the configuration to be migrated $validate = Move–AzureService –Validate –ServiceName $serviceName –DeploymentName $deploymentName –CreateNewVirtualNetwork $validate.ValidationMessages #Prepare for the migration, this will also create a new virtual network in the ARM portal Move–AzureService –Prepare –ServiceName $serviceName –DeploymentName $deploymentName –CreateNewVirtualNetwork #Migrate the VMs to the ARM portal Move–AzureService –Commit –ServiceName $serviceName –DeploymentName $deploymentName |
Step 3 – Migrate the storage of the classic VMs to the new ARM portal
1 2 3 4 5 |
#Prepare the storage accounts that are attached to the migrated VMs for migration Move–AzureStorageAccount –Prepare –StorageAccountName #Commit the storage account migration Move–AzureStorageAccount –Commit –StorageAccountName |
Step 4 – Clean up
- When you login to the new ARM portal, you’ll probably notice newly created resource groups with “-Migrated.” At this point, you will want to create a new resource group and consolidate all the migrated resources back into one group
- Select one of the migrated resource group, click move, select the resources, select the resource group and click OK. Repeat for all migrated groups. It will take a bit of time to move all the resources so be patient.
At this point, the migration is complete. All that’s left would be to test the new ARM VMs and address any minor issues as they arise.