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

javier 946 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.
{count} votes

Answer accepted by question author
  1. shiva patpi 13,376 Reputation points Microsoft Employee Moderator
    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. Mohammadmoein Torabi 36 Reputation points
    2022-06-30T22:42:46.32+00:00

    I had the same issue when trying to copy data from an azure blob storage into snowflake. My initial SAS URI was at the blob level, meaning that I went inside the container where my data was held and generated a SAS URI. This did not work and received the same error above. Next I tried to create a SAS URI at the storage account level instead and it fixed the authentication issue. I hope that helps whoever's reading this.

    7 people found this answer helpful.

  2. ANIS BANEKAR 26 Reputation points
    2021-08-30T21:24:16.263+00:00

    Hello @shiva patpi

    Hope you are doing well.

    I have created a SAS URL for Blob and while accessing that URL from browser I am getting the below 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.
    <AuthenticationErrorDetail>Signature did not match. String to sign used was r 2021-08-30T21:01:16Z 2021-08-31T05:03:16Z /blob/blobname/$root https 2020-08-04 c </AuthenticationErrorDetail>
    </Error>

    I tried to change the header using the chrome extension and set a new header request - x-ms-version: 2020-04-08

    But still we are getting the same error.

    It would be really helpful if you please assist me over it.

    5 people found this answer helpful.

  3. Anonymous
    2021-09-15T18:26:43.197+00:00

    Operation on target Copy data1 failed: Failure happened on 'Sink' side. ErrorCode=FileForbidden,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Error occurred when trying to upload a blob, detailed message: dbo.test_adf.txt,Source=Microsoft.DataTransfer.ClientLibrary,''Type=Microsoft.WindowsAzure.Storage.StorageException,Message=The remote server returned an error: (403) Forbidden.,Source=Microsoft.WindowsAzure.Storage,StorageExtendedMessage=Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    RequestId:d4324c64-c01e-000d-805e-aaad3d000000
    Time:2021-09-15T18:24:20.4319553Z,,''Type=System.Net.WebException,Message=The remote server returned an error: (403) Forbidden.,Source=Microsoft.WindowsAzure.Storage,'

    I am getting this error. Can someone help

    3 people found this answer helpful.

  4. Joaquim Ventura 16 Reputation points
    2021-11-30T15:38:32.933+00:00

    This can be caused by having the access keys to the storage account out of sync in the Azure ML Workspace.

    Running "az ml workspace sync-keys --name <workspace-name> -g <rg-name>" fixed this for me

    Best,

    Joaquim

    3 people found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.