When trying to connect to AzureFile URL getting InvalidHeader error

Lewis Wydner 0 Reputation points
2025-04-16T20:28:25.9633333+00:00

I am the owner and admin trying to setup FileShares in Azure enviroment. I have permissions and everything seems set correctly. However when I try to go to the URL I get the following error.

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<Error>

<Code>InvalidHeaderValue</Code>

<Message>The value for one of the HTTP headers is not in the correct format. RequestId:391865d2-c01a-0031-4409-afbd72000000 Time:2025-04-16T19:58:31.1959155Z</Message>

<HeaderName>x-ms-version</HeaderName>

<HeaderValue/>

</Error>

thanks for any advice

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,403 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Keshavulu Dasari 4,665 Reputation points Microsoft External Staff
    2025-04-16T22:10:38.4766667+00:00

    Hi Lewis Wydner ,

    Could you please provide more details about how you are making the request (e.g., the programming language or tool you are using).

    This error typically indicates that one of the HTTP headers in your request is not formatted correctly. Specifically, the error message points to the x-ms-version header.

    I Suggest few steps you can take to troubleshoot and resolve this issue:

    Ensure that the x-ms-version header is set correctly in your request. This header specifies the version of the Azure Storage service to use. It should be set to a valid version string,

    If you are using a script or code to make the request, verify that the x-ms-version header is included and correctly formatted. Ensure that your access token or authorization header is correctly set up and has the necessary permissions to access the file share.

    check your request for any typos or missing headers that might be causing the issue.

    For more information:

    https://stackoverflow.com/questions/35203205/azure-file-storage-url-in-browser-showing-invalidheadervalue

    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. 

    User's image

    If you have any other questions or are still running into more issues, let me know in the "comments" and I would be glad to assist you.

    1 person found this answer helpful.

  2. Venkatesan S 1,625 Reputation points Microsoft External Staff
    2025-04-17T12:27:25.1266667+00:00

    Hi @Lewis Wydner

    In my environment, I encountered the same error as well:
    enter image description here

    The above error occurs when the correct headers are not included in the request.

    According to this MS-Document,

    To access the file share URL, you need required headers like x-ms-date, x-ms-version, Authorization and x-ms-file-request-intent.

    For authorization, you need a token. You can get the access token using the following Azure CLI command in the cloud shell.

    Command:

    az account get-access-token --resource "https://storage.azure.com/"
    

    Output:

    enter image description here

    Here is the correct process to get the file from Azure file share.

    Request:

    GET https://venkat326123.file.core.windows.net/share1/demo.jpg 
    
    Headers: 
    Authorization : Bearer <token>
    x-ms-date:Thu : 17 Apr 2025 12:08:17 GMT
    x-ms-version : 2024-11-04
    x-ms-file-request-intent : backup
    

    Output:

    enter image description here

    Hope this answer helps! 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.


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.