Code works to move within storage account but not to another storage account


  • From @mkArtak via Twitter:

    Can you please help me with "StartCopyFromBlobAsync fails when copying between different storage accounts" issue ? The code I use works when copying within the same storage account. And fails - otherwise.

    await Task.Factory.FromAsync<string>(blob.BeginStartCopyFromBlob(sourceStorage.blob, null, null), blob.EndStartCopyFromBlob)

    I'd like to understand the issue in my code. Why it works for within the storage accounts, and fails between different



    Monday, June 20, 2016 9:01 PM

All replies

  • Here are more details about the issue.

                string copyId = null;
                    copyId = await Task.Factory.FromAsync<string>(destBlob.BeginStartCopyFromBlob(sourceBlob, null, null), destBlob.EndStartCopyFromBlob);
                catch (Microsoft.WindowsAzure.Storage.StorageException sex)

                     // ... handler here


    The above code is the full one. It works just fine, when the source and target blobs are in the same storage account. However, when the destination storage account is different, the below exception is thrown:

    Artak Mkrtchyan

    Monday, June 20, 2016 9:15 PM
  • How are you accessing the source and destination blobs? Are you using a Shared Access Signature to access one or both of them, or are you attempting to use Shared Key authentication for both?
    Monday, June 20, 2016 9:37 PM
  • We're using account keys.

    Artak Mkrtchyan

    Monday, June 20, 2016 9:39 PM
  • You will need to use a Shared Access Signature for one or both of the blobs, you can't use Shared Key for both.
    Monday, June 20, 2016 10:22 PM
  • I'm just trying to confirm my understanding:

    The storage account keys, which are technically providing ADMIN rights to the storage, won't work ? And why is there such a limitation ?

    Can you please point me out to some documentation - detailing the behavior ?


    Artak Mkrtchyan

    Tuesday, June 21, 2016 12:26 AM
  • You can refer the best practices for transferring from one storage account to another in the link. And Eric is right that you need Shared Access Signature for transfer.

    I hope it helps!

    - Vaibhav Gujral

    Tuesday, June 21, 2016 12:30 AM