无法使用 azcopy 从一个 blob 到另一个 SAS

Cannot use azcopy from one blob to another with SAS

我有 2 个 blob 存储,一个在 eastus,一个在 canadaeast,我想从 eastus 复制一个 .vhd 到 canadaeast。 我去东方,在我想复制的斑点上。我打开上下文菜单,单击生成 SAS。我生成具有 read/write/create/delete 权限的令牌并复制提供的 URL。

我遵循 https://docs.microsoft.com/en-gb/azure/storage/common/storage-use-azcopy-blobs

上的文档

我下载了 azcopy,然后输入:

 azcopy copy "source?SASToken" "destination"

我得到:

===== 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

我在目标帐户上生成一个具有 read/write/create/delete 权限的 SAS 令牌,然后键入:

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

我得到以下结果:

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

在生成的日志文件中,我得到

   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]

我被卡住了:我不知道如何将一个 blob 复制到不同位置的另一个 blob,我尝试的一切都失败了。

我做错了什么?你能帮忙吗?

根据我的测试,我们可以使用命令“azcopy copy "source?SASToken" "destination?SASToken"”将一个blob复制到另一个blob。详细步骤如下。 1.生成访问令牌

  1. 复制 blob

在存储帐户之间复制 blob 时,应注意当前 azcopy 版本中的以下限制。

  • 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).

您可以验证两个存储帐户是否满足上述要求,尤其是第三个。当我将 blob 从 storageV2 复制到 storageV1 时,我可以重现您的问题,然后附加 --s2s-preserve-access-tier=false,它起作用了。