azure-blob-storage - 无法通过 SAS 使用 azcopy 从一个 blob 到另一个 blob

标签 azure-blob-storage azcopy

我有 2 个 Blob 存储,一个在 eastus,一个在 canadaeast,我想将一个 .vhd 从 eastus 复制到 canadaeast。 我去了 eastus,在我想要复制的 blob 上。我打开上下文菜单,单击“生成 SAS”。我生成具有读/写/创建/删除权限的 token 并复制提供的 URL。

我遵循 https://learn.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

我生成一个对目标帐户具有读/写/创建/删除权限的 SAS token ,然后键入:

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,并且我尝试的所有操作都失败了。

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

最佳答案

在存储帐户之间复制 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 时,我可以重现您的问题,它可以工作。 enter image description here

关于azure-blob-storage - 无法通过 SAS 使用 azcopy 从一个 blob 到另一个 blob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57771128/

相关文章:

azure - AzCopy Powershell 工具 - 流日志仅允许一次传输

c# - AzCopy V10 复制文件

azure - 写入源容器时进行 AzCopy

Node.js Azure 存储 blob

azure - 如果提供了 DelimitedTextConfiguration,则无法使用查询 Blob 内容 API 查询 Azure Blob 存储

Azure Blob 服务,随机出现 404-未找到错误

azure - 为什么 Azcopy 适用于 Azure 中的小文件而不适用于大文件?

c# - 为 Azure 应用服务创建 blob 容器

azure - 从 Azure Blob 存储中的任何身份验证检查中排除 sig querystring 参数

azure - AzCopy - 什么是返回值?