Поделиться через


Azure copying VMs or blobs between subscriptions

Update: There is a new version of Azcopy 2.5 now available, see here:https://blogs.msdn.com/b/windowsazurestorage/archive/2014/08/08/azcopy-2-5-release.aspx

If you have more than 1 Azure subscription, you may have need to move or copy items between them. The excellent Azcopy application available here: aka.ms/AzCopy can be your friend. See this article for more details on Azcopy: https://blogs.msdn.com/b/windowsazurestorage/archive/2013/04/01/azcopy-using-cross-account-copy-blob.aspx

Here's an example of how to copy an entire Azure container (in this case a container of VHDs) and it's contents between subs: 

cls $env:path += ";${env:ProgramFiles(x86)}microsoft sdkswindows azureazcopy" $sourceContainer = 'https://your-source-container-name.blob.core.windows.net/vhds' $destinationContainer = 'https://your-destination-container-name.blob.core.windows.net/vhds' $sourcekey = 'your-source-container-key' $destkey = 'your-destination-container-key' $logPath = 'c:dumpcopyblob.log' Azcopy $sourceContainer $destinationContainer /SourceKey:$sourcekey /DestKey:$destkey /S /Z:$logPath

Don't forget the /S parameter as this is used for a recursive copy from the ~/vhd container down in the above example. If you want to move files rather than copy them you can use the /MOV switch.