Unable to upload an image to my blob storage account

ProDevs 0 Reputation points
2024-05-03T08:58:12.4+00:00

So i am trying to upload an image to my blob storage and I keep getting this error

<Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

I have generated a SAS key and my code looks like this

await dio!.post( uploadUrl, data: streamData, options: Options( headers: { //Headers.contentLengthHeader: fileBytes.length, //"x-ms-blob-type": "BlockBlob", "x-ms-version": "2017-11-09", 'Authorization': 'SharedAccessSignature $sasToken', 'Content-Type': 'image/jpeg', }, ), );

With my upload URL being
String uploadUrl = 'https://palynxapp.blob.core.windows.net/palynxapp/$fileName$sasToken';

What am I doing wrong please

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,468 questions
.NET F#
.NET F#
.NET: Microsoft Technologies based on the .NET software framework.F#: A strongly typed, multi-paradigm programming language developed by the F# Software Foundation, Microsoft, and open contributors.
94 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Amrinder Singh 2,685 Reputation points Microsoft Employee
    2024-05-06T09:38:40.2333333+00:00

    Hi ProDevs - Thanks for reaching out.

    This appears to be some mismatch in SAS generations and the URL again which it might be getting called.

    Can you please verify if your container name matches the storage account name? Based on the above it appears to be the same.

    If not, then I would recommend printing the request URL once, to see if the container name matches the one in the URL.

    Please let us know if you have any further queries. I’m happy to assist you further.    


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.