Steps to copy VHDs between azure storage accounts

Steps to copy VHDs between azure storage accounts

In this blog, we will show you the steps to copy VHDs between azure storage accounts using command line interface.

 

REQUIREMENTS

  • Microsoft Azure Subscription
  • AzCopy
  • VM (or) Physical Machine.

 

Note: We are using Windows 2016 VM for this demo.

 

DOWNLOADING AzCOPY

Steps to copy VHDs between azure storage accounts

 

  • Scroll down and click on Install Release version click under AzCopy Command-Line Tool for Azure Storage topic.

Steps to copy VHDs between azure storage accounts

 

  • Download the MicrosoftAzureStorageTools.msi file on the desktop.

Steps to copy VHDs between azure storage accounts

Steps to copy VHDs between azure storage accounts

 

INSTALLING AzCOPY

  • Double-click on the MicrosoftAzureStorageTools.msi file and it shows the welcome setup screen. Click Next to continue.

Steps to copy VHDs between azure storage accounts

 

  • Accept the license agreement and click Next.

Steps to copy VHDs between azure storage accounts

 

  • Specify the destination folder for the installation and click Next.

Steps to copy VHDs between azure storage accounts

 

  • Click Install to begin the installation.

Steps to copy VHDs between azure storage accounts

 

  • Click Finish to complete the installation.

Steps to copy VHDs between azure storage accounts

 

STORAGE OVERVIEW

  • Log in to the Azure portal using your subscription and click on storage accounts under services list.

Steps to copy VHDs between azure storage accounts

 

  • For this demo, we have created 2 storage accounts named grsstorageaccount01 and azstorageaccount03.

Steps to copy VHDs between azure storage accounts

 

  • We are copying the data VHD named az-vm-01-datadisk.vhd from grsstorageaccount01 (Source) to azstorageaccount03 (Destination).

Steps to copy VHDs between azure storage accounts

 

FINDING PRIVATE KEYS AND CONTAINER URL

  • Login to your Azure portal and click on Storage accounts link from the service list.

Steps to copy VHDs between azure storage accounts

 

  • Click on the source storage account named grsstorageaccount01 and select the Access Keys option.

Steps to copy VHDs between azure storage accounts

 

  • There are two access keys are available for each storage account. For grsstorageaccount01 storage account, we can use either one key. For this demo, we are using key1.

Steps to copy VHDs between azure storage accounts

 

  • The key1 is used for azstorageaccount03 (Destination) account.

Steps to copy VHDs between azure storage accounts

 

  • To find the URL of a storage account, click on the storage account and select Blobs services.

Steps to copy VHDs between azure storage accounts

 

  • Select the context menu of a container and select container properties.

Steps to copy VHDs between azure storage accounts

 

  • You can find the container full URL under URL section.

Steps to copy VHDs between azure storage accounts

 

COPY VHD BETWEEN STORAGE CONTAINERS

  • Click on the start menu and select Microsoft Azure Storage command line.

Steps to copy VHDs between azure storage accounts

 

  • A new command line windows will open as shown below.

Steps to copy VHDs between azure storage accounts

 

  • Use the command azcopy to copy the VHD files between Azure storage accounts. The command syntax is shown below.

Azcopy /source:<The URL of source storage account container> /Dest:<The URL of destination storage account container> /sourcekey:<The source storage account access key> /destkey:<The destination storage account access key> /pattern:<filename>

 

  • The example command to copy the contents is given below.

azcopy /source:https://grsstorageaccount01.blob.core.windows.net/vhds/ /Dest:https://azstorageaccount03.blob.core.windows.net/vhds/ /sourcekey:BtzB79MVlfbQ58yavo5YTk8urfR3DfFw4V/nZ/Q5/5r3z7ArmVlBzadIrNl5ImavBr2gsFZMeQsj7kRDJy490A== /destkey:05MSmqECVwG8WLUZQBJb6h7tEgVhdl9s2lim50YbuiP695hi4T+sJ5EXEdMhIEZ5i2a9mjA5ccsDr4kvOPCJGA== /pattern:az-vm-01-datadisk.vhd

Steps to copy VHDs between azure storage accounts

 

  • It will take few minutes based on the VHD size to complete the operation.

Steps to copy VHDs between azure storage accounts

 

VERIFICATION

  • Open the destination BLOB (Binary Large Object) storage account azstorageaccount03 and click on blobs link.

Steps to copy VHDs between azure storage accounts

 

  • Click on the vhds container.

Steps to copy VHDs between azure storage accounts

 

  • You can able to see the VHD file is available in this container.

Steps to copy VHDs between azure storage accounts

 

VIDEO

 

Thanks for reading this blog. We hope it was useful for you to know about the Azcopy command and it’s usage.



Author: Loges
Logeswaran holds Microsoft certified engineer & solution architect certifications with over 11+ years of experience in the fields of hosting technologies and IMS/Cloud consulting. At AssistanZ, Logeswaran spearheads the strategic planning and execution of the company’s Microsoft based core technologies to Enterprise clients.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.