Powershell is very handy when you need some quick way of moving your data around. Some time back i was thinking that, moving data between azure storage account is very rare task, and you may not have good reason to do it.
And to achieve that i have written little powershell script , which did my job very easily.
We can leverage more options of AzCopy command at
https://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy/
Some time you need to move data between storage account, which are in different azure subscription.
In any case there can be different way of doing same task. recently i was given a task to move azure storage account blobs from one storage account to another storage account manually :).
May be i am lazy , but moving data manually from one storage account to another is error prune task.
I was looking for a automated way , to do manual assignment.
And to achieve that i have written little powershell script , which did my job very easily.
Here is the script.
Most of the script is self explanatory. I have used AzCopy.exe to achieve this task. we can write same code in C#, using windows azure storage client library.
#Start Writing Log to target file Start-Transcript -path D:\AzCopyLog.log -append #Path to AzCopy.exe, look at https://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy/ for more help $AzCopyPath='C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy' $AzCopySourceAccountName='<SOURCE-STORAGE-ACCOUNT>' $AzCopySourceAccountKey='<SOURCE-STORAGE-KEY>' $AzCopyDestAccountName='<DEST-STORAGE-ACCOUNT>' $AzCopyDestAccountKey='<DEST-STORAGE-KEY>' #Get Storage Account Context for listing all containers $Ctx = New-AzureStorageContext -StorageAccountName $AzCopySourceAccountName -StorageAccountKey $AzCopySourceAccountKey #List of containers on source storage account. $list=Get-AzureStorageContainer -Context $Ctx | select name #Iterate over all containers, and execute AzCopy command for each container. foreach ( $item in $list ) { #Container name $container=$item.Name #Log container name ECHO 'Container Name:'`t$container #Execure AzCopy Command CMD /C $AzCopyPath /Source:https://$AzCopySourceAccountName.blob.core.windows.net/$container /Dest:https://$AzCopyDestAccountName.blob.core.windows.net/$container /SourceKey:$AzCopySourceAccountKey /DestKey:$AzCopyDestAccountKey /S /Y } ECHO '#'$list.Count 'containers, successfully copied.' Stop-Transcript
Most of the script is self explanatory. I have used AzCopy.exe to achieve this task. we can write same code in C#, using windows azure storage client library.
We can leverage more options of AzCopy command at
https://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy/
In this manner, the report gives top to bottom cross-section investigation for the man-made consciousness advertise and orders it into different levels, along these lines giving important experiences on full scale just as smaller scale level. artificial intelligence course
ReplyDeleteHello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. storage boxes
ReplyDeleteAgain the age old question of whether mind set is important or skill set is important. artificial intelligence certification
ReplyDeleteThe most common food storage containers are the plastic containers. glass food storage containers
ReplyDelete