How can i copy blobs between storage account with Azure Storage Library?
            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);
                    
                    destBlob.StartCopy(blockBlob);
                }
            }

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?

September 9th, 2015 5:04am

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

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 11:35am

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

  • Proposed as answer by Zhaoxing Lu 16 hours 20 minutes ago
September 9th, 2015 3:32pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics