How to move a Windows Azure VM to a different affinity group?
Asked Answered
U

2

6

I created a VM in Windows Azure's West US data center. Now I find out it requires frequent connection with another VM I created on another machine in Windows Azure's East US data center. The second machine is already belonging to a affinity group. It will be best if I can move the first VM to the same affinity group as the second machine. Because there are already quite a bit of data in the first VM, data migration could be painful. Help!

After some experiments, I finally give up. Although I can successfully copy the vhd from one data center to the other, the configuration would not work. It is possible to make it work, but you would need to run sysprep command to erase the configuration information from the former data center.

Urbai answered 9/3, 2013 at 0:51 Comment(0)
D
2

In new SDK the template command are:

azure vm disk upload “http://sourcestorage.blob.core.windows.net/vhds/sample.vhd” “http://destinationstorage.blob.core.windows.net/vhds/sample.vhd” “DESTINATIONSTORAGEACCOUNTKEY”

Don't forget to make the VHDs "public" and get the KEY on "Managed Key" option on Portal.

Debouchment answered 17/7, 2013 at 0:34 Comment(0)
I
1

You can perform an asynchronous blob copy from US West to US East (from one storage account to another), copying the VHD of your virtual machine. At that point, you should be able to start up the virtual machine in US East based on that vhd, within the correct affinity group.

There's a bit of work around creating an image from the virtual machine - this msdn resource should be a great starting place.

EDIT: You can execute an async blob copy via the Windows Azure cross-platform command line tools, available for Windows, Mac, and Linux (download here ). The syntax is:

azure vm disk upload <source-url> <target-url>

Source url is either a public blob or a private blob with shared access signature. The target url uses the storage account info you configure via the command-line tool:

azure config set defaultStorageAccount

More info on the command-line tools, here, including instructions for downloading subscription info.

Ionic answered 9/3, 2013 at 2:7 Comment(7)
This might also help: gauravmantri.com/2012/07/04/…Rosenarosenbaum
Thanks! Is there a way to do this via CLI/Powershell?Urbai
One key thing in this whole thing is async blob copying which I believe is not exposed through PowerShell Cmdlets. You could either make use of Windows Azure storage client library in PowerShell for copying blob or make use of 3rd party tools like Cerebrata Azure Management Cmdlets for copying blob. All other VM related operations can then be performed using Windows Azure PowerShell Cmdlets.Rosenarosenbaum
Through the cross-platform command line interface (available for Windows, Mac, Linux), you execute azure vm disk upload. This uses async blob copy. Download from hereIonic
it seems azure vm disk upload cannot copy private sourced blob, true?Urbai
@AlbertCheng - not true. You just need to generate a Shared Access Signature (SAS) for the private blob, as source. Works great.Ionic
@AlbertChang if you are copying from a private blob and have difficulties using the SAS, you can use -k option to specify the source storage keyDyanna

© 2022 - 2024 — McMap. All rights reserved.