1
votes

I'm trying to move a virtual machine (ARM) between subscriptions.

With V1 machines the process was straight forward.

  • shut down machine
  • copy vhd to storage account in new subscription
  • mark vhd as boot drive
  • create VM in new subscription using this boot drive

I have tried to create a new ARM virtual machine and replace the vhd file, but this does not work as the vhd blob has a lease even when the machine is shut down.

Is there a way using PowerShell to achieve this?

1

1 Answers

1
votes

This should work -

Set-AzureRmVMOSDisk -VM $vm -Name "test" -VhdUri $uri -CreateOption attach -Windows 

Wrapped into the rest of a VM Create script