Azure Blob Storage fails to authenticate: "Make sure the value of Authorization header is formed correctly including the signature"

javier 926 Reputation points
2021-03-28T22:05:03.557+00:00

Hi I am trying to upload a binary file (a blob for an excel file, actually) to my storage account but the client fails to authenticate under the error message: 403 (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.)

Note that:

  • SAS key is being generated successfully
  • Blob service client is being generated using uri coming from SAS key generation response (so I believe it has the correct format
  • Angular app with "@azure/storage-blob": "^12.5.0"

Would much appreciate any help on this one

async uploadFileToAzure(file : Blob, filename : string){

    let params = {
      "filename": filename, 
      "container" : 'attachments', 
      'connkey' : 'xxx'
    };

    this._authService.getSAS(params).subscribe(async sas=>{

      var blobUri = 'https://xxx.blob.core.windows.net/';
      const blobServiceClient = new BlobServiceClient(`${sas["uri"]}`);
      const containerClient = blobServiceClient.getContainerClient(params["container");
      const blockBlobClient = containerClient.getBlockBlobClient(filename);

      const uploadBlobResponse = await blockBlobClient.upload(file, file.size);
      console.log(`Upload block blob successfully`, uploadBlobResponse.requestId);
    })
  };

Thanks

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,552 questions
{count} votes

Accepted answer
  1. shiva patpi 13,156 Reputation points Microsoft Employee
    2021-03-29T03:24:51.467+00:00

    Hello @javier ,
    Thanks for your query !
    Can you validate if your storage account is firewall enabled ?

    Steps:-
    Azure Portal -> Storage Account -> Networking -> Check Allow Access From (All Networks / Selected Networks)
    If it is "Selected Networks" - It means the storage account is firewall enabled.

    If the storage account is firewall enabled , check your angular app is whitelisted to access.

    Couple of additional work arounds mentioned here
    https://stackoverflow.com/questions/24492790/azurestorage-blob-server-failed-to-authenticate-the-request-make-sure-the-value

    Let us know if the above steps helps out in resolving the issue , please don't forget to Upvote and Accept the Answer

    3 people found this answer helpful.

9 additional answers

Sort by: Most helpful
  1. ChristerEwald 0 Reputation points
    2024-05-28T13:52:14.78+00:00

    AuthenticationFailed

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

    Start working after shorten the expiration time to 1year

    0 comments No comments