doc_noob
doc_noob

Reputation: 625

az storage upload file not working as expected

I have been trying to upload a folder to azure file share by following this link, it never works for me, does this really work as mentioned in that link or do we need to do anything extra to make it work. Here is what i did from a shell, just ran the following command as mentioned in that URL

az storage file upload-batch --connection-string "DefaultEndpointsProtocol=https;AccountName=asdadasd;AccountKey=ahdsidyagdasgdhasdghdgasdasjdag4857348574;EndpointSuffix=core.windows.net" --destination . --source /dfiles/folder

And i get the below error

Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. ErrorCode: AuthenticationFailed
<?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:af9004d7-301a-0069-26e8-25db2b000000
Time:2020-05-09T09:57:19.5414005Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request 'gDQ+MYQgNglorkiZ3LkmHHNI56odT4FfxesXUhlK/TY=' is not the same as any computed signature. Server used following string to sign: 'PUT
x-ms-client-request-id:7747952b-91db-11ea-a2c1-000d3af2c73b
x-ms-content-length:90592
x-ms-date:Sat, 09 May 2020 09:57:19 GMT
x-ms-type:file
x-ms-version:2018-11-09
/storage/createdump'.</AuthenticationErrorDetail></Error

I am not sure what am i missing here. Any help on this would be appreciated.

Upvotes: 1

Views: 2392

Answers (2)

Pedro Es
Pedro Es

Reputation: 91

I will leave a feedback from me also. Do not use --sas-token. For the sas-token we need to use '<sastoken>' and it will work properly.

Also use below statement structure and for sure it will work:

az storage file upload-batch --account-name <storageName> -d '<shareName>/<example_folder>' --source <source_folder> --connection-string 'DefaultEndpointsProtocol=https;AccountName=<storageName>;AccountKey=<accountKey>;EndpointSuffix=core.windows.net'

with variables:

az storage file upload-batch --account-name $storageName -d $fsName --destination-path <folder> --source <sourceFolder> --connection-string $cs

Upvotes: 0

Gaurav Mantri
Gaurav Mantri

Reputation: 136296

Instead of specifying . for destination, please try by specifying a share name.

az storage file upload-batch --connection-string "DefaultEndpointsProtocol=https;AccountName=asdadasd;AccountKey=ahdsidyagdasgdhasdghdgasdasjdag4857348574;EndpointSuffix=core.windows.net" --destination <share-name> --source /dfiles/folder

Upvotes: 2

Related Questions