微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

AzCopy v10.5.1:从文件共享复制到Blob容器时出错

如何解决AzCopy v10.5.1:从文件共享复制到Blob容器时出错

尝试将所有文​​件从Azure文件共享复制到同一存储帐户中的Blob容器时出现错误

$rg = "[REDACTED]"
$storageAccount = "[REDACTED]"
$storageAccountKey = (Get-AzStorageAccountKey -ResourceGroupName $rg -AccountName $storageAccount ).Value[0]
$context = New-AzStorageContext -StorageAccountName $storageAccount -StorageAccountKey $storageAccountKey
$sourceSAS = New-AzStorageShareSASToken     -Context $context -ExpiryTime (Get-Date).AddHours(24*3) -Permission "rdw" -ShareName "[REDACTED]" -FullUri
$destSAS   = New-AzStorageContainerSASToken -Context $context -ExpiryTime (Get-Date).AddHours(24*3) -Permission "rdw" -Name "[REDACTED]" -FullUri
azcopy.exe copy $sourceSAS $destSAS --recursive=true

并收到此错误

INFO: Scanning...
INFO: Failed to create one or more destination container(s). Your transfers may still succeed if the container already exists.
INFO: Any empty folders will not be processed,because source and/or destination doesn't have full folder support

Failed to perform copy command due to error: cannot start job due to error: cannot list files due to reason -> github.com/Azure/azure-storage-blob-go/azblob.newStorageError,/home/vsts/go/pkg/mod/github.com/!azure/azure-storage-blob-go@v0.10.0/azblob/zc_storage_error.go:42
===== RESPONSE ERROR (ServiceCode=AuthorizationPermissionMismatch) =====
Description=This request is not authorized to perform this operation using this permission.
RequestId:b0027090-a01e-0088-18c7-6ff7a6000000
Time:2020-08-11T10:08:06.6069744Z,Details: 
   Code: AuthorizationPermissionMismatch
   GET https://[REDACTED].blob.core.windows.net/[REDACTED]?comp=list&delimiter=%2F&include=Metadata&restype=container&se=2020-08-14t10%3A03%3A25z&sig=-REDACTED-&sp=rwd&sr=c&sv=2018-11-09&timeout=901
   User-Agent: [Azcopy/10.5.1 Azure-Storage/0.10 (go1.13; Windows_NT)]
   X-Ms-Client-Request-Id: [efe44227-df00-47e1-74e4-f7a8670e0ace]
   X-Ms-Version: [2019-02-02]
   --------------------------------------------------------------------------------
   RESPONSE Status: 403 This request is not authorized to perform this operation using this permission.
   Content-Length: [279]
   Content-Type: [application/xml]
   Date: [Tue,11 Aug 2020 10:08:06 GMT]
   Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0]
   X-Ms-Client-Request-Id: [efe44227-df00-47e1-74e4-f7a8670e0ace]
   X-Ms-Error-Code: [AuthorizationPermissionMismatch]
   X-Ms-Request-Id: [b0027090-a01e-0088-18c7-6ff7a6000000]
   X-Ms-Version: [2019-02-02]

如果我尝试了这2个工作正常:

azcopy.exe copy "C:\TEMP" $destSAS --recursive=true
azcopy.exe copy "C:\TEMP" $sourceSAS --recursive=true

我在订阅中具有所有者访问角色。

我在github中发现了这个问题,并将其发布在了这里: https://github.com/Azure/azure-storage-azcopy/issues/518

有什么想法吗?

欢呼

解决方法

当您请求SAS令牌时,还需要确保也授予列表权限,其正确的语法是rwdl。如果您需要here,我也包括了该命令的参考。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。