Over a million developers have joined DZone.

Moving Data In, Out, and Between Azure Storage Accounts Using AzCopy

DZone's Guide to

Moving Data In, Out, and Between Azure Storage Accounts Using AzCopy

A useful way to move your data around the Azure cloud.

· Cloud Zone
Free Resource

Production-proven Mesosphere DC/OS is now even better with GPU scheduling, pods, troubleshooting, enhanced security, and over 100+ integrated services deployed in one-click.

The little script I demoed at IT Camp @Houston. Just:

  1. Install AzCopy.
  2. Copy the script as it is.
  3. Validate the source path, destination path, and associated Azure storage account access keys.
  4. Run it.

Here is the entire PowerShell script. The source and the destination storage accounts can be different subscriptions. Namely it can do cross-subscription copying.

$theSource      = @{path=’?’; accessKey=’?’; recursion=”; pattern=”}
$theDestination = @{path=’?’; accessKey=’?’}

<# Validate the data

$theSource.path      = ‘/Source:https://nothere.blob.core.windows.net/abcdefg’ 
$theSource.AccessKey = ‘/SourceKey:mySourceStorageAccessKey’                   

$theDestination.path      = ‘/Dest:https://mydest.blob.core.windows.net/ContainerTOBeCreated’
$theDestination.AccessKey = ‘/DestKey:myDESTStorageAccessKey’


$theSource.pattern         = ” 
$theSource.recursion       = ‘/S’
$supressConfirmationPrompt = ‘/Y’
$listingOnlyOption         = ”   # or /L

$verbose        = ‘on’
$verboseLogFile = “$env:USERPROFILE\documents\”+(get-date -format ‘mmss’)+’.azcopy.verbose.txt’
$verboseLog     =”/V:$verboseLogFile”

$responsefile = “$($theSource.path) “+
                “$($theDestination.path) “+ 
                “$($theSource.AccessKey) “+
                “$($theDestination.AccessKey) “+
                “$($theSource.pattern) $($theSource.recursion) $supressConfirmationPrompt “+
#                “$snapshot “+
                “$listingOnlyOption “+ 

start-process `
    -FilePath         ‘C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe’ `
    -WorkingDirectory ‘C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy’ `
    -ArgumentList     “$responsefile” `

if ($verbose -eq ‘on’) { notepad $verboseLogfile }

Simply build, test, and deploy. Mesosphere DC/OS is the best way to run containers and big data anywhere offering production-proven flexibility and reliability.

azure ,data ,acopy ,powershell ,cloud

Published at DZone with permission of Yung Chou, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}