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

Haseeb Ahmed 0 Reputation points
2025-01-02T14:55:29.06+00:00

I am setting up azure storage in my project using django-storages. I've allowed requests from all networks for testing purposes. I'm able to upload the files without any issues but when I try to access them I get the error mentioned above. The issue is

azure.storage.blob._generated.operations._service_operations.get_user_delegation_key()

method as it raises an exception. The request header is empty whereas I think it should pass a token. The problem with the error message is that I don't know what I'm missing or doing wrong. Any help will be highly appreciated.

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,201 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Hari Babu Vattepally 3,345 Reputation points Microsoft External Staff Moderator
    2025-01-02T16:31:07.51+00:00

    Hi @Haseeb Ahmed

    Welcome to Microsoft Q&A Forum and thanks for posting your query here!

    As per the error message mentioned above, we see that it could be typically due to the authorization process when accessing Azure Storage. The error message suggests that the request is not authenticated.

    Please consider checking the following suggestions to resolve the issue.

    1. Check if the SAS token has expired. Even though the SAS token has valid dates, it is possible that it has expired. Make sure that the SAS token is still valid and has not expired. Try shortening the expiration time to 1 year.
    2. Check if the SAS token has the correct permissions. Make sure that the SAS token has the correct permissions to upload files to the Azure storage account.
    3. Check if the SAS token has the correct format. Make sure that the SAS token has the correct format and that it includes all the required parameters.
    4. Check if there are any network connectivity issues. Make sure that there are no network connectivity issues that may be preventing the request from being authenticated.
    5. Verify System Time (Make sure that the system time on the machine generating the SAS token is accurate. A significant time discrepancy could lead to authentication failures)
    6. Try to regenerate New SAS token and upload
    7. For testing purpose can you upload using Storage account key and Storage explorer or azcopy tool?

    Try to create a SAS URI at the storage account level instead of container level to fix the authentication issue. More examples are available in the CLI documentation. Make sure you include all the necessary permissions for the SAS token, a list can be found here.

    Refer - https://learn.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas

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

    azurestorage-blob-server-failed-to-authenticate-the-request-make-sure-the-value

    Similar SO thread for reference - https://stackoverflow.com/questions/58565283/azure-blob-storage-sas-error-authenticationfailed, https://stackoverflow.com/questions/25038429/azure-shared-access-signature-signature-did-not-match, https://github.com/Azure/azure-sdk-for-java/issues/38467.

    Please let us know if this solves the issue and do let us know if you have any further queries.


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


Your answer

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