Migrate classic Azure resources to new Azure resou

2019-09-11 01:49发布

问题:

After switching to the new Azure portal, I see all resources of mine are listed as classic resources. I am googling around to see if it's possible to have classic VM and migrate it to ARM and just hadn't seen anything that stated it was possible.

I tried deleting the class VM but keep the VHD to check if I can attach it to the ARM VM. The result said it doesn't work.

Is there any way that can be used to achieve this ?

回答1:

Unfortunately (and strangely!) there isn't a way to do this via the portal and you have to drop down to Powershell instead (or xplat / Rest)

When I have exported VMs from v1 to v2 I typically make the original vhd file accessible via a blob share (this can be done temporarily for the duration of this command)

You can then deploy a new VM using that vhd as a source image's URI, using

Set-AzureRmVMOSDisk -VM $vm -Name $vmname -VhdUri $uri -CreateOption FromImage -Windows 

Alternatively you can copy the vhd to v2 storage and use Attach instead of FromImage

If you wrap that around a standard VM Create script, you should be good to go!



回答2:

There is a set of powershell scripts to assist in migrating classic vms to the new resource group model - asm-arm

They require the Azure and AzureRM powershell modules - msdn link to installation instructions