Skip to content

Instantly share code, notes, and snippets.

@sdurandeu
Created March 28, 2014 20:55
Show Gist options
  • Save sdurandeu/9842815 to your computer and use it in GitHub Desktop.
Save sdurandeu/9842815 to your computer and use it in GitHub Desktop.
Async Blob Copy - Windows Azure
## For reference see http://michaelwasham.com/windows-azure-powershell-reference-guide/copying-vhds-blobs-between-storage-accounts/
Import-Module Azure
Set-AzureSubscription -SubscriptionName "Azure SDK Testing" -CurrentStorageAccount "portalvhdsq1x0n4q4zbfq5"
Select-AzureSubscription "Azure Store SDK Testing"
$destContext = New-AzureStorageContext –StorageAccountName "{destAccountName}" `
-StorageAccountKey "{destAccountKey}"
$sourceContext = New-AzureStorageContext –StorageAccountName "{sourceAccountName}" `
-StorageAccountKey "{sourceAccountKey}"
#New-AzureStorageContainer -Name "teamcityvm"
### Asynchronous Copy From Blob Context to Blob Context ###
$blob1 = Start-CopyAzureStorageBlob -SrcContext $sourceContext -SrcBlob "gtnqfg43.ugz201402182142260377.vhd" -SrcContainer "vhds" `
-DestContext $destContext -DestContainer "teamcityvm" -DestBlob "teamcity81-sysprep-image.vhd"
### Asynchronous Copy From URL to Blob Context ###
Set-AzureSubscription -SubscriptionName "WACOM DevTest" -CurrentStorageAccount "teamcity81vm"
$blob1 = Start-AzureStorageBlobCopy -srcUri "http://azurestorebackups.blob.core.windows.net/teamcityvm/teamcity81-sysprep-image.vhd" `
-DestContainer "vhds" `
-DestBlob "teamcity81-sysprep-image.vhd" `
-DestContext $destContext
## Get State
$blob1 | Get-AzureStorageBlobCopyState
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment