How can i copy blobs between storage account with Azure Storage Library? RRS feed

  • Question

  •             CloudBlobContainer cloudSourceContainer = <Source Container>
                CloudBlobContainer cloudDestinationContainer = <Destination Container>
                var blobItems = cloudSourceContainer.ListBlobs(null, true);
                foreach(var blob in blobItems)
                    if(blob is CloudBlockBlob)
                        CloudBlockBlob blockBlob = blob as CloudBlockBlob;
                        CloudBlockBlob destBlob = cloudDestinationContainer.GetBlockBlobReference(blockBlob.Name);

    I use above code to copy blobs from one container to another container(in different storage account), it gives me an error(The remote server returned an error: (404) Not Found. --- The specified resource does not exist.)

    I checked, if the public access type of source container is Container or Blob, then these code work fine. But the question is, in my situation both source container and destination container are only private access type. in the request sent to Azure, it only has the shared key about destination storage account(or container), but no shared key information about the source storage account. 

    So, What's the correct way to copy blobs when both source and destination container are only with private access type, with Azure Storage Library?

    Wednesday, September 9, 2015 9:01 AM


  • Hi,

    I would recommend is that you create SAS URLs with Read Permission on your source blobs and copy using those SAS URLs. Since the blob copy is asynchronous, I would recommend keeping the SAS URL valid for 7 days (maximum time allocated for copy operation).

    Girish Prajwal

    Wednesday, September 9, 2015 3:32 PM