How to Copy Azure Blob across Microsoft Azure Datacenters using AzCopy

 

Today's need is to work on cloud platforms across datacenters, it maybe your own datacenter or Public Cloud like Azure. How would you move a storage blob within regions?

There are various techniques to achieve this however we will focus on "AzCopy“ , its simple and easy also my favorite in recent times.

Scenario: We want to migrate Blob data (Virtual Machine in this example) across Azure Regions.

Here is the configuration: Our goal is to move blob (VM) from West US to East Asia.

STORAGE

 Untitled picture2

Steps involved.

Migrating VM from Cloud service in one Location to another

1. Download and Install the latest version of AzCopy (I used version 4.1.0.107)

V4.1.0 Current preview version. Supports synchronously copying blobs and files and specifying content type for destination blobs and files

2. Make a note of your storage keys : (source and destination storage account)

Untitled picture

3. Open PS Console on your system and go to the path:  (command)

C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy  :

AzCopy /Source:https://myaccount.blob.core.windows.net/mycontainer1 /Dest:https://myaccount.blob.core.windows.net/mycontainer2 /SourceKey:key /DestKey:key /Pattern:*.VHD 

You can find more about the Azcopy command line switches here: http://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy/ or simply run AzCopy /?

Untitled picture1

(Notice that the file transfer is in progress). Once the transfer is complete, the command returns the status of files transferred. 

4. At this point, if I go to my storage account for East Asia, I can locate the migrated VHD file there. 

clip_image010

5. I am ready to use the migrated files! Now, I will create a disk from this VHD -->

clip_image012

Make sure to select the check make “The VHD contains an operating system” incase you are copying a VM (Server OS) and not just the data disk.

6. Once the Disk is created, Go to the gallery to add a VM from My disks.

clip_image014

Once the VM is created using the Gallery > Disks, you can begin using the newly migrated Azure VM in East Asia.

clip_image016

Hope this helps you .

Special thanks to Prayag for sharing his experience and knowledge and contributing to InfraTalks.