【发布时间】:2022-02-17 16:26:56
【问题描述】:
我正在使用这个命令来生成 SAS,
az storage container generate-sas --account-name mystorageaccount --as-user --auth-mode login
--expiry 2022-02-17T08:19Z --name container1 --permissions dlrw
但是。当我尝试使用 azcopy 复制我的容器时,它说我没有权限。
azcopy cp "https://[srcaccount].blob.core.windows.net?[SAS]" "https://[destaccount].blob.core.windows.net?[SAS]"
--recursive
错误:
RESPONSE Status: 403 This request is not authorized to perform this operation using this permission.
Content-Length: [279]
Content-Type: [application/xml]
Date: [Thu, 17 Feb 2022 05:21:16 GMT]
Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0]
X-Ms-Client-Request-Id: [xxx-xx-x-x-x-xx]
X-Ms-Error-Code: [AuthorizationPermissionMismatch]
X-Ms-Request-Id: [xx-x-x-x-x-xx]
X-Ms-Version: [2019-12-12]
但是当我通过 GUI 为我的 azure 存储帐户容器生成 SAS 时,我使用容器检查允许的资源,然后它就可以工作了。
SAS GUI Example 如何通过 az 客户端允许资源?有人可以帮我解决这个问题吗?
编辑:
所以我正在生成两个 SAS。 第一个用于: storageaccount => 'storageaccount1' 和 container => '/Container1'。 (换句话说,源容器,它给出了 SAS1)
第二个用于:storageaccount => 'storageaccount1' 和 container => '/Container2'。 (换句话说,目标容器,它给出了 SAS2)
并在 azcopy 中使用这两个容器。
azcopy cp "https://<storage_account>.blob.core.windows.net/<Container1>/<folder2>?<SAS1>" "https://<storage_account>.blob.core.windows.net/<Container2>/<foldeer2>?<SAS2>" --recursive=true
【问题讨论】: