Skip to content

Instantly share code, notes, and snippets.

@sballarati
Last active September 20, 2016 15:56
Show Gist options
  • Save sballarati/b761dab52de1508a2ab1 to your computer and use it in GitHub Desktop.
Save sballarati/b761dab52de1508a2ab1 to your computer and use it in GitHub Desktop.
Copies an Azure blob to another account
#change the current storage account
Set-AzureSubscription -SubscriptionName "{source subscription}" -CurrentStorageAccount "{storage account name}"
Select-AzureSubscription "{source subscription}"
$destContext = New-AzureStorageContext –StorageAccountName "{destination storage account}" -StorageAccountKey ""
$sourceContext = New-AzureStorageContext –StorageAccountName "{source account}" -StorageAccountKey ""
#New-AzureStorageContainer -Name "{container name}"
### Asynchronous Copy From Blob Context to Blob Context ###
$blob1 = Start-CopyAzureStorageBlob -SrcContext $sourceContext -SrcBlob "{blob name}" -SrcContainer "{container}" -DestContext $destContext -DestContainer "{container}" -DestBlob "{blob destination}"
#$blob2 = {you can copy the previous statement to copy more than one blob in paralell}
$blob1 | Get-AzureStorageBlobCopyState
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment