Copying Objects (Blob) in cross Azure Subscriptions

In Azure copying objects from one subscription to another subscription OR within same subscription is very easy without any complexity. In this copy you don’t need to provide subscription ID or address etc.

To access storage accounts in Azure a key is required. Key you can get from Azure portal (As shown below in properties of Azure Storage Account). 




#=======================================
#Put Your Source Storage Account Name
#=======================================
$MySourceStorageAccountName = ""
#=======================================
#Put Your Storage Key of Source Account
#=======================================
$MySourceStorageAccountKey = ""
$MySourceContainerName = ""
$MySourceContext = New-AzureStorageContext -StorageAccountName $MySourceStorageAccountName -StorageAccountKey $MySourceStorageAccountKey
#=======================================
#Put Your Destination Storage Account
#=======================================
$MyDestinationStorageAccount = ""
#=======================================
#Put Your Storage Key of Destination Account
#=======================================
$DestStorageAccountKey = ""
#=======================================
#Put Your Destination Container Name
#=======================================
$MyDestinationContainerName = ""
$MyDestinationContext = New-AzureStorageContext -StorageAccountName $MyDestinationStorageAccount -StorageAccountKey $DestStorageAccountKey
#=======================================
#Get a reference to blobs in the source container.
#=======================================
$blobs = Get-AzureStorageBlob -Container $MySourceContainerName -Context $MySourceContext
#=======================================
# Copy blob(Data) Source to Destination container
#=======================================
$blobs| Start-AzureStorageBlobCopy -DestContainer $MyDestinationContainerName -DestContext $MyDestinationContext
view raw CopyingBlobs hosted with ❤ by GitHub