0

I am trying to upload a file to Azure via API. I generate a writable url and then send a PUT request with the file attached, however it keeps failing. I use an API client on my local mac. I generate an url like this:

https://baseurl.blob.core.windows.net/test/testfile1.csv?sv=2014-02-14&sr=b&sig=coW+B3AU/9A30ssj14k+tdClLmW3Ix81EzCQM6IkPzc=&st=2021-07-06T00:33:39Z&se=2021-07-06T02:38:39Z&sp=rw\

I attach a csv file from my local machine to the request and when I run it I keep getting the following error:

Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

Any idea how I can get this to work?

davidb
  • 1,503
  • 4
  • 30
  • 49
  • Can you validate if your storage account is firewall enabled ? Can you re-generate the New SAS toke and try again Couple of additional work arounds mentioned here https://stackoverflow.com/questions/24492790/azurestorage-blob-server-failed-to-authenticate-the-request-make-sure-the-value https://stackoverflow.com/search?tab=newest&q=Make%20sure%20the%20value%20of%20Authorization%20header%20is%20formed%20correctly%20including%20the%20signature – SumanthMarigowda-MSFT Jul 07 '21 at 10:18

1 Answers1

0

So the problem was with timestamps in the SAS token. I don't know why but my I would have only a few seconds to send a request before the token expired. Out of 10 times I would be too late 9 times. This would happen almost each time I tried it from my local pc. Once I used this on a server in Azure it worked each time.

davidb
  • 1,503
  • 4
  • 30
  • 49