TropicalIPA
TropicalIPA

Reputation: 13

AzureStorage Blob Server failed to authenticate the request. Error while trying to DELETE file despite uploading files working

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]

Upvotes: 1

Views: 1145

Answers (1)

Venkatesan
Venkatesan

Reputation: 10455

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

Upvotes: 0

Related Questions