1
votes

Is it possible to copy from a RA-GRS secondary using Start-AzureStorageBlobCopy?

It works using AZCopy, but when I try using the Azure cmdlet I get the following warning and nothing is copied:

WARNING: Ignore mismatch source storage context.. The source uri is https://portalvhdsblahblah-secondary.blob.core.windows.net/vhds/VM3.vhd, the end point is https://portalvhdsblahblah.blob.core.windows.net/.

Interestingly when explore object with Show-Object, there is no secondary URI listed for the container or blob. Although the Storage Account shows that a Read Access secondary is listed as available.

I've seen reference to this in a script online, but when I run the script I get the same error as above. Has the API changed? I've tried using ARM and ASM.

Again this work OK using AZCopy....

1
Microsoft responded to my MSDN thread saying it's not currently possible using Powershell Azure cmdlets...would love for some one to prove them wrong. In the meantime I'm going to try and set the Secondary URI on the Container/Blob using the API which I am hoping is the reason PowerShell doesn't work.Merlus

1 Answers

1
votes

Currently PowerShell Cmdlet Start-AzureStorageBlobCopy is not convenient enough to select secondary or primary if you use a basic Context to authenticate.

There are 2 ways to work around.

1) Use a source Uri containing the Authentication info: you may manually make up SAS url for secondary, since secondary and primary share the same SAS. For example:

$src = 'http://account1-secondary.blob.core.windows.net/con1/blob1'+(New-AzureStorageBlobSASToken -Container con1 -Blob blob1 -Permission r -Context $srcContext)

Start-AzureStorageBlobCopy -SrcUri $src -DestContainer con2 -DestBlob blob1 -DestContext $DestContext

2) Create a Context with customized endpoints with explicitly set to secondary. For example:

$srcctx = New-AzureStorageContext -ConnectionString "DefaultEndpointsProtocol=https;AccountName=***;AccountKey=***;BlobEndpoint=http://***-secondary.blob.core.windows.net;FileEndpoint=http://***-secondary.file.core.windows.net;QueueEndpoint=http://***-secondary.queue.core.windows.net; TableEndpoint=http://***-secondary.table.core.windows.net;

Start-AzureStorageBlobCopy –Container *** -Blob *** -Context $srcctx –DestContainer *** -DestBlob *** -DestContext $destctx