1

I'm trying to delete file from Azure Storage Account Blob and I'm geting the following error:

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

I'm using SAS Token to authenticate my request;

I can list blobs using:

https://[myaccount].blob.core.windows.net/[mycontainer]/?restype=container&comp=list

I'm succesfully uploading files to my container using powershell and command azcopy, but when i try DELETE request i get error mentioned above.

My request URL looks like:

https://[myaccount].blob.core.windows.net/[mycontainer]/[myfile]?sv=2020-08-04&ss=bfqt&srt=sco&sp=rwdlacupitfx&se=2035-11-17T01:45:55Z&st=2021-11-16T17:45:55Z&spr=https&sig=[mysignature]

1 Answers1

0

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

The above error occurs when you try with the wrong sas token or you may given the wrong sas parameter you have passed in your SAS-URL.

I tried in my environment and got the below results:

You can get the SAS token with the URL in the portal below:

Portal:

enter image description here

Postman:

enter image description here

The above request was made successfully and deleted the blob successfully in my environment.

Update:
If you need to delete the container level you can get the SAS token from the portal:

enter image description here

Add your container name and file name inside the SAS_URL which you want to delete.

https://venkat123.blob.core.windows.net/test/sample.txt?sv=2022-11-02&ss=bfqt&srt=sco&sp=rwdlacupiytfx&se=2023-07-19T17:12:25Z&st=2023-07-19T09:12:25Z&spr=https&sig=xxxxxxxx

The above request will delete your file by changing your filename.

Reference:

Delete Blob (REST API) - Azure Storage | Microsoft Learn

Venkatesan
  • 3,748
  • 1
  • 3
  • 15
  • My SAS token seems to be correct, because it authenticates my request when i use azcopy command to send files to my container. Or maybe I'm mixing up concepts – TropicalIPA Jul 19 '23 at 08:34
  • @TropicallPA Have you tried my approach? – Venkatesan Jul 19 '23 at 08:37
  • Unfortunately i can't get SAS tokens for each file in container. For other containers DELETE request works using SAS generated for container (and not individual file). I only have problem with cointainer that was shared for me (and i was provided with SAS token). Is there posibility that container or Storage Account has wrong configuration? – TropicalIPA Jul 19 '23 at 08:57
  • @TropicalIPA Check the updated answer. – Venkatesan Jul 19 '23 at 09:22