Search code examples
azure-blob-storageazcopy

Cannot use azcopy from one blob to another with SAS


I have 2 blob storages, one in eastus, one in canadaeast, and I want to copy one .vhd from eastus to canadaeast. I go to the the eastus, on the blob I want to copy. I open the contextual menu, click on generate SAS. I generate the Token with read/write/create/delete rights and copy the URL provided.

I follow the documentation on https://learn.microsoft.com/en-gb/azure/storage/common/storage-use-azcopy-blobs

I downloaded azcopy, and type:

 azcopy copy "source?SASToken" "destination"

I get :

===== RESPONSE ERROR (ServiceCode=ResourceNotFound) =====
Description=The specified resource does not exist.
RequestId:60890ddf-601e-0040-5a4b-62d6ba000000
Time:2019-09-03T11:34:08.5367479Z, Details:
   Code: ResourceNotFound

I generate a SAS token with read/write/create/delete rights on the destination account, then type:

azcopy copy "source?SASToken" "destination?SASToken"

I get the following result:

Job a30eaae3-1dfd-f94d-5237-002ababea22c summary
Elapsed Time (Minutes): 0.0334
Total Number Of Transfers: 1
Number of Transfers Completed: 0
Number of Transfers Failed: 1
Number of Transfers Skipped: 0
TotalBytesTransferred: 0
Final Job Status: Failed

In the generated log file, I get

   RESPONSE Status: 400 The value for one of the HTTP headers is not in the correct format.

Content-Length: [325]
Content-Type: [application/xml]
Date: [Tue, 03 Sep 2019 10:07:21 GMT]
Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0]
X-Ms-Error-Code: [InvalidHeaderValue]
X-Ms-Request-Id: [1ef8bbe7-a01e-0019-313f-62d33c000000]
X-Ms-Version: [2018-11-09]

I am stuck : I don't know how to copy one blob to another on a different location, and everything I tried failed.

What do I do wrong? Can you help?


Solution

  • You should note the following limitations in the current azcopy release when you copy blobs between storage accounts.

    • Only accounts that don't have a hierarchical namespace are supported.
    • You have to append a SAS token to each source URL. If you provide authorization credentials by using Azure Active Directory (AD), you can omit the SAS token only from the destination URL.
    • Premium block blob storage accounts don't support access tiers. Omit the access tier of a blob from the copy operation by setting the s2s-preserve-access-tier to false (For example: --s2s-preserve-access-tier=false).

    You could verify if the two storage accounts meet the above requirements, especially the third one. I can reproduce your issue when I copy blobs from storageV2 to storageV1, then I append the --s2s-preserve-access-tier=false, it works. enter image description here