IaaS Migration from Azure Service Manager to Azure Resource Manager

By introduction of the New Azure Portal, Azure deployment model also changed from Azure Service Manager to Azure Resource Manager. Because of this change we have to manage two types of IaaS VMs, Virtual Machine (classic) & Virtual Machine (ARM). If someone wants to move the classic VMs to ARM model, yes we can achieve it now.

Microsoft has introduce a tool called MigAz to accomplish this. Lets look at high level understanding about it. By using this tool it create a JSON ARM template based on the ASM resources and we can use that JSON template to deploy the same infrastructure in ASM.

For this demo I used a single IIS VM deployed as a ASM model and we can do same to any multi tier IaaS architectures too.

IIS running on ASM VM

First create a VM in classic model (ASM) and install IIS. Then I check the server is running.

2

Lets start the migration by installing migAz tool

Run the MigAz tool. we can get it from the GitHub. Run the migAz.exe.

3

Click the Sign In and add Azure credentials then select the subscription.

Next select the resources want to migrate and select output location for the JSON template.

Click Export objects to create the JSON files.

6

It export two JSON files as below.

copyblobdetail.json – Include the details of the storage account(s) eg:- Storage Key, Storage Account Name


{
  "SourceSA": "classicvm4797",
  "SourceContainer": "vhds",
  "SourceBlob": "classicvm-os-8235.vhd",
  "SourceKey": "<KEY>",
  "DestinationSA": "classicvm4797v2",
  "DestinationContainer": "vhds",
  "DestinationBlob": "classicvm-os-8235.vhd",
  "DestinationKey": "<KEY>",
  "Status": "",
  "TotalBytes": 0,
  "BytesCopied": 0,
  "StartTime": "2016-11-13 15:21:53Z",
  "EndTime": "",
  "SnapshotTime": "11/13/2016 9:51:50 AM"
}

export.json – It include the JSON template of the environment

8

9

Open PowerShell ISE and login to azure tenant, then select the subscription.

Login-AzureRmAccount

10

Create a new  resource group in the subscription.

New-AzureRmResourceGroup -Name ASM-ARM-Mig -Location southeastasia

11

Now lets use the export.json file to deploy the resources to RG we created previously

New-AzureRmResourceGroupDeployment -Name mig-asm -ResourceGroupName ASM-ARM-Mig -TemplateFile .\export.json -Verbose

At some point at the deployment of the template you will get an error message as follows and fail the deployment. DON’T BE PANIC !!!!!

12

If you closely read the error message you will find it says DiskBlobNotFound  and give the blob URL, we get this because we export the VMs configuration and create the storage account  in ARM model but we didn’t copy the blobs to new storage account.

13

So lets copy the blobs from ASM storage account to ARM storage account.For this we can use  BlobCopy.ps1 PowerShell script comes with migAz.

.\BlobCopy.ps1 -ResourcegroupName ASM-ARM-Mig -DetailsFilePath C:\Users\localadmin\Desktop\migaz\copyblobdetails.json -StartType StartBlobCopy -Verbose 

14

Blob was copied

15

Now lets redeploy the export.json and it works perfectly.

16

ARM resource group shows relevant resources

18

Lets see the IIS still works as before, I enter the public IP of the ARM VM and it works.

19

17

Additional Resources 

Migrate Azure IaaS Solutions from ASM to ARM Using migAz, Part 1

Migrate Azure IaaS Solutions from ASM to ARM Using migAz, Part 2