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

后端 未结 14 1772
無奈伤痛
無奈伤痛 2020-12-09 14:58

I\'m trying to upload a image in Windows Azure Blob and I\'m geting the following error which I can\'t handle.

Server failed to authenticate the request.

相关标签:
14条回答
  • 2020-12-09 15:33

    I got this message when I was trying to access BLOB Storage through REST API Endpoint.

    Below is the response that I got when invoked list container operation with Authorization header

    <?xml version="1.0" encoding="utf-8"?>
    <Error>
        <Code>AuthenticationFailed</Code>
        <Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    RequestId:096c6d73-f01e-0054-6816-e8eaed000000
    Time:2019-03-31T23:08:43.6593937Z</Message>
        <AuthenticationErrorDetail>Authentication scheme Bearer is not supported in this version.</AuthenticationErrorDetail>
    </Error>
    

    solution was to include below header

    x-ms-version: 2017-11-09
    
    0 讨论(0)
  • 2020-12-09 15:37

    in my case it was actually the shared access signature (SAS) that expired. updating (actually making a new one) the shared access signature in portal.azure.com by adding a year (or more) for end date in the future. And all problems fixed.

    0 讨论(0)
  • 2020-12-09 15:39

    I migrated an app from one machine to another, migrating the connection string across. The public IP was unchanged and the URL was not expired, yet I got this error.

    It appears that once used a connection string URL is tied to that machine - perhaps other fingerprints are added on first use.

    I have no evidence for this but it worked after generating a new connection string.

    0 讨论(0)
  • 2020-12-09 15:39

    I was getting the same error, but what is really strange, I was getting the error in 2 of 3 storage accounts that I was running some code with. What fixed this for me is to update the Azure.Storage.Files.DataLake library to a preview version 12.2.2. That fixed the issue. Tried all other suggestions, time sync, etc. None of it worked. Really weird issue.

    0 讨论(0)
  • 2020-12-09 15:39

    In my case (python), had to encode the upload content from string to bytes. Not sure why the error message says this though:

    azure.core.exceptions.ClientAuthenticationError: 
    Server failed to authenticate the request. 
    Make sure the value of Authorization header is formed correctly including the signature.
    

    Here is what worked.

    Versions:

    $ python -V
    Python 3.7.7
    $ pip list | grep azure
    azure-core               1.8.1
    azure-storage-blob       12.4.0
    

    and the python function to upload:

    def upload_blob(blob_service_client, content: str, container_name, blob_name):
        blob_client = blob_service_client.get_blob_client(container_name, blob_name)
        try:
            content_bytes = content.encode('utf-8')
            blob_client.upload_blob(content_bytes)
            return True
        except Exception as e:
            logger.error(traceback.format_exc())
            return False        
    
    0 讨论(0)
  • 2020-12-09 15:42

    We ran into the same error when tried to connect to a Storage account from a simple Azure AppService. After lot of investigation, we asked the official Microsoft Support to help. They checked our resources and infrastructure in Azure, and pointed out that the problem is related to Application Insights, here is the official answer:

    there is an additional header ‘x-ms-request-root-id‘ in the request which gets added after the authorization header is signed for storage client request. As a result, when the request is authenticated by Azure Storage it results into 403. This seems to be getting added by the Application Insights, if the dependency tracking is enabled..

    So after disabling the dependency tracking in /dev/wwwroot/ApplicationInsights.config, the error disappeared, and AppService can connect to storage account without any problem.

    0 讨论(0)
提交回复
热议问题