Open blueww opened 3 years ago
The workaround is input the dest sas together with destpath in like -DestPath "$($dirname3)$($sas)"
,see following sample:
Note: There’s a limitation in PSH: when you input -Destpath in this way, Powershell will always think the dest path not exist, so won’t ask user to confirm overwrite even the dest path exist. (Powershell will take destpath+sastoken as path name in check dest path exist.)
# Prepare: Create SAS from account key
$ctx = New-AzStorageContext -StorageAccountName $accountName -StorageAccountKey $key
$sas = New-AzStorageContainerSASToken -Name $filesystemName -Permission rwdl -Context $ctx
$sasctx = New-AzStorageContext -StorageAccountName $ctx.StorageAccountName -SasToken $sas
# this sas token created with New-AzStorageContainerSASToken has prefix “?”. If sas token doesn’t have prefix “?”, need use -DestPath "$($dirname3)?$($sas)"
$dir3 = Move-AzDataLakeGen2Item -Context $sasctx -FileSystem $filesystemName -Path $dirname1 -DestFileSystem $filesystemName -DestPath "$($dirname3)$($sas)"
We will consider to give a more formal fix after SDK fix this. After the fix, the above workaround might not work anymore.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @sumantmehtams.
Author: | blueww |
---|---|
Assignees: | - |
Labels: | `Data Lake Storage Gen2`, `Service Attention`, `needs-triage` |
Milestone: | - |
I have a slightly different (403 and "Signature did not match. String to sign used was ...") error when I am using New-AzStorageContainerSASToken. In my case, the returned token already has the "?" prefix, but I still get this exception.
New-AzStorageContainerSASToken -Context $signingContext -Name $containerName -Permission rcwl -Protocol HttpsOnly -StartTime (Get-Date) -ExpiryTime (Get-Date).AddDays(70)
results in this token:
?sv=2019-07-07&sr=c&sig=XXXXXXXXXXXX%2BtpBQaDPrfPU%3D&spr=https&st=2021-07-19T13%3A28%3A34Z&se=2021-09-27T13%3A28%3A34Z&sp=rcwl
An AzStorageContext generated from that SAS token appears to be similar to a context generated from a UI-calculated token, but the cmdlets throw this exception when I use the context:
Set-AzStorageBlobContent : Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. HTTP Status Code: 403 - HTTP Error Message: Server failed to authenticate the request. Make sure
the value of Authorization header is formed correctly including the signature.
ErrorCode: AuthenticationFailed
ErrorMessage: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
Time:2021-07-19T13:28:58.5864077Z
AuthenticationErrorDetail: Signature did not match. String to sign used was rcwl
2021-07-19T13:28:34Z
2021-09-27T13:28:34Z
.....
@hkelley I can't repro this issue with latest Az.Storage 3.9.0.
Following is my repro script:
$ctx = New-AzStorageContext -StorageAccountName $accountname -StorageAccountKey $accountkey
$sas = New-AzStorageContainerSASToken -Context $ctx -Name $containerName -Permission rcwl -Protocol HttpsOnly -StartTime (Get-Date) -ExpiryTime (Get-Date).AddDays(70)
$sasctx = New-AzStorageContext -StorageAccountName $accountname -SasToken $sas
Set-AzStorageBlobContent -Container $containerName -Blob testblob -File $localSrcFile -Context $sasctx -Force
Would you please share:
As this is for a different issue than the original one, would you please open a new issue, and if you following the issue template, we should can get most information needed for investigation.
Description
Move-AzDataLakeGen2Item fails with 403 while using SAS token. This is because we also need input SAS token for dest item, but SDK don't provide API to input the dest SAS token.
Steps to reproduce
Environment data
Module versions
Debug output
Error output