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]

如果我尝试这两个工作很好:

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。如果你需要的话,我也在这里提供了命令的参考。

相关内容

最新更新