401 Unauthorized "Audience validation failed" from ADLS endpoint

Shubhank 0 Reputation points
2024-05-03T11:11:59.4933333+00:00

We are using service principal credentials to authenticate using OAuth2 token. Fetching the access token step is successful however, request getting failed when hitting ADLS endpoint .

Error response : Exact error message : {"AuthenticationErrorDetail":"Audience validation failed. Audience did not match."}}}.The 401 error message is usually returned by services that requires user credentials

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,370 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Amrinder Singh 3,170 Reputation points Microsoft Employee
    2024-05-06T06:59:35.34+00:00

    Hi Shubhank - Thanks for reaching out.

    There are couple of options to explore for this exception:

    1. Verify what's the audience used for generating the token? Please verify it to be from storage.azure.com and then test it ahead.
    2. SPN is gaining token from same tenant where the storage account is hosted. This can also cause issue with validation of the token when presented to storage.

    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.