How to clone blob in azure storage container with Shared Access Signature? RRS feed

  • Question

  • I have a shared access signature to a container with full permission (read, write, delete, list). After upload a file successfully to storage, I want to create a copy of file in the same container. But, it always throw "The specified resource does not exist" error. My code:

    string sasLink = GetAzureStorageContainerLink();
    _container = new CloudBlobContainer(sasLink);    
    _blob = _container.GetBlobReference("a.txt");
    _uploadTransfer.UploadBlobAsync(_blob, @"C:\a.txt");
    CloudBlob blobTarget = container.GetBlockBlobReference("b.txt");
    blobTarget.StartCopyFromBlob(_blob); // This line throws error

    Before implement this feature with SAS, my code run properly with Azure storage credential. My SAS link:


    How can I create a copy of blob in same container with SAS?

    Wednesday, October 22, 2014 7:08 AM


  • Hi,

    You could refer the mentioned code from the following link to create a new BLOB in the container using SAS.


    string blobContent = "This blob was created with a shared access signature granting write permissions to the blob. ";
            MemoryStream msWrite = new MemoryStream(Encoding.UTF8.GetBytes(blobContent));
            msWrite.Position = 0;
            using (msWrite)
            Console.WriteLine("Write operation succeeded for SAS " + sas);
        catch (StorageException e)
            Console.WriteLine("Write operation failed for SAS " + sas);
            Console.WriteLine("Additional error information: " + e.Message);

    And you could use the copy blob operation to copy the required data.
    You could refer the following link for details:



    Wednesday, October 22, 2014 10:34 AM