I want to copy a file from fileshare x to a directory in fileshare y under the same Azure storage account. However I get authentication error. Here is what I have tried:
az login
azcopy copy "https://mystorageaccount.file.core.windows.net/x/mydir/myfile.dmp?sv=2021-06-08&ss=bfqt&srt=sco&sp=rwdlacupiytfx&se=2022-08-18T14:11:48Z&st=2022-08-18T13:11:48Z&sip=myip&spr=https&sig=****" "https://mystorageaccount.file.core.windows.net/y/mydir?sv=2021-06-08&ss=bfqt&srt=sco&sp=rwdlacupiytfx&se=2022-08-18T14:14:18Z&st=2022-08-18T13:14:18Z&sip=myip&spr=https&sig=****"
I used the same SAS token for both source and destination as the both fileshares are under the same storage account.
As I got error, I tried it by generating one SAS with Key1 for source and one with Key2 for destination but no success.
Error:
INFO: Trying 4 concurrent connections (initial starting point)
INFO: Authentication failed, it is either not correct, or expired, or does not have the correct permission -> github.com/Azure/azure-storage-file-go/azfile.newStorageError, /home/vsts/go/pkg/mod/github.com/!azure/azure-storage-file-go@v0.6.1-0.20201111053559-3c1754dc00a5/azfile/zc_storage_error.go:42
===== RESPONSE ERROR (ServiceCode=CannotVerifyCopySource) =====
Description=Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RESPONSE Status: 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
Content-Length: [322]
Content-Type: [application/xml]
Date: [Thu, 18 Aug 2022 13:34:12 GMT]
Server: [Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0]
X-Ms-Client-Request-Id: [****]
X-Ms-Error-Code: [CannotVerifyCopySource]
X-Ms-Request-Id: [****]
X-Ms-Version: [2020-10-02]
I have also tried with the following command but no success either:
az storage file copy start --source-uri "https://mystorageaccount.file.core.windows.net/x/mydir/myfile.dmp" --destination-path 'mydir' --destination-share y --account-name mystorageaccount --sas-token "?sv=2021-06-08&ss=f&srt=sco&sp=rwdlc&se=2022-08-18T15:00:27Z&st=2022-08-18T14:00:27Z&sip=myip&spr=https&sig=****"
I would appreciate if someone can help with this.
Please try by removing the IP restrictions from your SAS token.
Copy blob operation is a server-side copy where storage service is copying the data.
Putting IP restrictions in your SAS token is preventing the storage service to read the data from the source.