AI search indexer listing is throwing unauthorized exception when RBAC is enabled

lakshmi 821 Reputation points
2024-07-09T18:21:45.5533333+00:00

Hi team,

We are using the Search Indexer client to list all available indexers.

The API works when the network is enabled with selected networks or Ip address.

But we need the network to be disabled in the deployed version. In this scenario, the web app must call the search service to list all indexers, but we are getting an unauthorized access error.

We have tried the following steps:

  • Provided RBAC role for the web app in AI Search.
  • Created a shared private network from AI Search to the web app.

We are still facing the unauthorized access error

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 39,106 Reputation points Volunteer Moderator
    2025-10-20T18:41:42.12+00:00

    Hello !

    Thank you for posting on Microsoft Learn Q&A.

    In your search service go to settings then keys, set authentication to role based access control (or both during migration). If it’s still keys only then AAD tokens are rejected with 401.

    https://free.blessedness.top/en-us/azure/search/search-get-started-rbac

    Assign the managed identity of your web app these roles at the search service scope:

    Don't forget that role propagation can take a bit and recycle the app to force a fresh token.

    https://free.blessedness.top/en-us/azure/search/search-security-rbac

    You can use the data plane endpoint: https://<your-service>.search.windows.net not the ARM management endpoint and when you use the official SDKs with DefaultAzureCredential, they request a token for the search resource automatically so if you create tokens yourself, make sure the audience matches that value, or you’ll get 401/403.

    https://free.blessedness.top/en-us/python/api/overview/azure/search-documents-readme?view=azure-python

    0 comments No comments

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.