Copy blobs between storage accounts using AzCopy

The easy way is using AzCopy. There are also methods to do this asynchronously in powershell but I like the path of least resistance.

  1. Install Microsoft Azure Storage Tools from here.?http://aka.ms/downloadazcopy
  2. Get the URL for both storage account containers that contain the blob.
  3. Get the name of the blob
  4. Get the access keys for both storage accounts
  5. Change the values in the script below to match the source, destination, keys, and pattern (blob).
  6. Run this in powershell.
    cd "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy" #Get to AzCopy dir
    $source = "https://SourceSAName.blob.core.windows.net/ContainerName" #Source storage account and container
    $dest = "https://DestSAName.blob.core.windows.net/ContainerName" #Destination storage account and container
    $sourcekey = "***************" #Source storage account key
    $destkey = "*****************" #Destination storage account key
    $pattern = "AblobFile.vhd" #The blob to copy. Can be anything, just put the full file name including extension
    #Run the command
    .\AzCopy /Source:$source /Dest:$dest /sourcekey:$sourcekey /destkey:$destkey /Pattern:$pattern

Leave a Comment

Your email address will not be published.

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