Created
April 7, 2015 08:10
-
-
Save pkirch/b32a6c5989d1e2e37152 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"--> Set for current storage account. Only necessary for 2nd example." | |
Set-AzureSubscription -SubscriptionName "MSFT MVA Stage" -CurrentStorageAccountName "storagesource" | |
"--> Get keys for storage accounts storagesource and storagedestination." | |
$keys1 = Get-AzureStorageKey -StorageAccountName storagesource | |
$keys2 = Get-AzureStorageKey -StorageAccountName storagedestination | |
"--> Create two storage contexts for storagesource and storagedestination." | |
$contextSource = New-AzureStorageContext -StorageAccountName $keys1.StorageAccountName -StorageAccountKey $keys1.Primary | |
$contextDestination = New-AzureStorageContext -StorageAccountName $keys2.StorageAccountName -StorageAccountKey $keys2.Primary | |
"--> Get blobs from containers source1, source2, and destination1." | |
Get-AzureStorageBlob -Context $contextSource -Container source1 | |
Get-AzureStorageBlob -Context $contextSource -Container source2 | |
Get-AzureStorageBlob -Context $contextDestination -Container destination1 | |
"--> Example 1: Copy single BLOB from storagesource\source1 to storagedestination\destination1." | |
Start-AzureStorageBlobCopy -Context $contextSource -SrcContainer source1 -SrcBlob "Test1.txt" -DestContext $contextDestination -DestContainer destination1 | |
"--> Example 2: Copy all text files from current storage account storagesource\source1 to storagedestination\destination1." | |
Get-AzureStorageBlob -Container source1 -Blob "*.txt" | | |
Start-AzureStorageBlobCopy -DestContext $contextDestination -DestContainer destination1 | |
"--> Example 3: Copy text files back from storagedestination\destination1 to storagesource\source2." | |
Get-AzureStorageBlob -Context $contextDestination -Container destination1 -Blob "*.txt" | | |
Start-AzureStorageBlobCopy -DestContext $contextSource -DestContainer source2 | |
"--> Get blobs from containers source1, source2, and destination1." | |
Get-AzureStorageBlob -Context $contextSource -Container source1 | |
Get-AzureStorageBlob -Context $contextSource -Container source2 | |
Get-AzureStorageBlob -Context $contextDestination -Container destination1 | |
<# Output | |
--> Set for current storage account. Only necessary for 2nd example. | |
--> Get keys for storage accounts storagesource and storagedestination. | |
--> Create two storage contexts for storagesource and storagedestination. | |
--> Get blobs from containers source1, source2, and destination1. | |
Container Uri: https://storagesource.blob.core.windows.net/source1 | |
Name BlobType Length ContentType LastModified SnapshotTime | |
---- -------- ------ ----------- ------------ ------------ | |
Test1.txt BlockBlob 18 text/plain 02.04.2015 16:02:07 +00:00 | |
Test2.txt BlockBlob 18 text/plain 02.04.2015 16:02:06 +00:00 | |
Test3.txt BlockBlob 18 text/plain 02.04.2015 16:02:06 +00:00 | |
--> Example 1: Copy single BLOB from storagesource\source1 to storagedestination\destination1. | |
Container Uri: https://storagedestination.blob.core.windows.net/destination1 | |
Name BlobType Length ContentType LastModified SnapshotTime | |
---- -------- ------ ----------- ------------ ------------ | |
Test1.txt BlockBlob 18 text/plain 07.04.2015 08:08:15 +00:00 | |
--> Example 2: Copy all text files from current storage account storagesource\source1 to storagedestination\destination1. | |
Test1.txt BlockBlob 18 text/plain 07.04.2015 08:08:26 +00:00 | |
Test2.txt BlockBlob 18 text/plain 07.04.2015 08:08:18 +00:00 | |
Test3.txt BlockBlob 18 text/plain 07.04.2015 08:08:18 +00:00 | |
--> Example 3: Copy text files back from storagedestination\destination1 to storagesource\source2. | |
Container Uri: https://storagesource.blob.core.windows.net/source2 | |
Name BlobType Length ContentType LastModified SnapshotTime | |
---- -------- ------ ----------- ------------ ------------ | |
Test1.txt BlockBlob 18 text/plain 07.04.2015 08:08:27 +00:00 | |
Test2.txt BlockBlob 18 text/plain 07.04.2015 08:08:27 +00:00 | |
Test3.txt BlockBlob 18 text/plain 07.04.2015 08:08:27 +00:00 | |
--> Get blobs from containers source1, source2, and destination1. | |
Container Uri: https://storagesource.blob.core.windows.net/source1 | |
Name BlobType Length ContentType LastModified SnapshotTime | |
---- -------- ------ ----------- ------------ ------------ | |
Test1.txt BlockBlob 18 text/plain 02.04.2015 16:02:07 +00:00 | |
Test2.txt BlockBlob 18 text/plain 02.04.2015 16:02:06 +00:00 | |
Test3.txt BlockBlob 18 text/plain 02.04.2015 16:02:06 +00:00 | |
Container Uri: https://storagesource.blob.core.windows.net/source2 | |
Name BlobType Length ContentType LastModified SnapshotTime | |
---- -------- ------ ----------- ------------ ------------ | |
Test1.txt BlockBlob 18 text/plain 07.04.2015 08:08:27 +00:00 | |
Test2.txt BlockBlob 18 text/plain 07.04.2015 08:08:27 +00:00 | |
Test3.txt BlockBlob 18 text/plain 07.04.2015 08:08:27 +00:00 | |
Container Uri: https://storagedestination.blob.core.windows.net/destination1 | |
Name BlobType Length ContentType LastModified SnapshotTime | |
---- -------- ------ ----------- ------------ ------------ | |
Test1.txt BlockBlob 18 text/plain 07.04.2015 08:08:26 +00:00 | |
Test2.txt BlockBlob 18 text/plain 07.04.2015 08:08:18 +00:00 | |
Test3.txt BlockBlob 18 text/plain 07.04.2015 08:08:18 +00:00 | |
#> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment