AI Search Knowledgebase created in MS Foundry: "An unexpected error occurred. Verify role assignments and network access"

Jason Lee 216 Reputation points
2025-11-26T19:23:19.43+00:00

Hi,

In MS Foundry, I created a new Blob storage knowledgebase by doing this.
User's image

When I create an agent to use it, the agent just says "I’m currently having trouble retrieving the latest listings." and the trace says everything was fine
User's image

When I try the knowledge base directly in portal, it says "An unexpected error occurred. Verify role assignments and network access for your search service and other connected resources, then try again" but no other details.
User's image

I'm using RBAC and I verified the Foundry (i.e. Open AI) roles were assigned as per https://learn.microsoft.com/en-us/azure/search/agentic-retrieval-how-to-retrieve, plus added some additional ones just in case.
User's image

How do I diagnose this problem? Any suggestions on solutions?

Thanks in advance!

Azure AI Language
Azure AI Language
An Azure service that provides natural language capabilities including sentiment analysis, entity extraction, and automated question answering.
{count} votes

2 answers

Sort by: Most helpful
  1. Jason Lee 216 Reputation points
    2025-11-27T17:41:53.9633333+00:00

    I figured out a workaround. I created the KB manually via the Python SDK as discussed in this article https://learn.microsoft.com/en-us/azure/search/agentic-retrieval-how-to-create-knowledge-base?tabs=rbac&pivots=python#create-a-knowledge-base . When I add my manually created KB to my agent, it works. Here's my script which I modified from the original to use a user assigned identity (as Aryan mentioned, system assigned identity is not supported by AI Search yet). Note I had to remove some fields mentioned in the article which are not supported by the SDK yet.

    from azure.identity import DefaultAzureCredential
    from azure.search.documents.indexes import SearchIndexClient
    from azure.search.documents.indexes.models import (
        SearchIndexerDataUserAssignedIdentity,
        KnowledgeBase,
        KnowledgeBaseAzureOpenAIModel,
        KnowledgeSourceReference,
        AzureOpenAIVectorizerParameters,
    )
    
    index_client = SearchIndexClient(endpoint = "https://---.search.windows.net", credential = DefaultAzureCredential())
    
    aoai_params = AzureOpenAIVectorizerParameters(
        resource_url = "https://---.openai.azure.com",
        deployment_name = "---",
        model_name = "gpt-5",
        auth_identity = SearchIndexerDataUserAssignedIdentity(resource_id= "/subscriptions/---/resourcegroups/---/providers/Microsoft.ManagedIdentity/userAssignedIdentities/---")
    )
    
    knowledge_base = KnowledgeBase(
        name = "----",
        description = "---.",
     
        knowledge_sources = [
            KnowledgeSourceReference(name = "ks-weekend-events"),
        ],
        models = [KnowledgeBaseAzureOpenAIModel(azure_open_ai_parameters = aoai_params)],
     
    )
    
    index_client.create_or_update_knowledge_base(knowledge_base)
    print(f"Knowledge base '{knowledge_base.name}' created or updated successfully.")
    
    1 person found this answer helpful.
    0 comments No comments

  2. Aryan Parashar 3,380 Reputation points Microsoft External Staff Moderator
    2025-11-27T10:13:20.48+00:00

    Hi Jason Lee,

    I understand the inconvenience this may have caused.

    To mitigate this issue quickly, please make sure your authentication type is set to API key as shown below.
    User's image

    If you want to use Managed Identity, I suggest using User Assigned Identity.

    Using both (System Assigned and User Assigned) identities can create issues, as the Managed Identity feature for Search Service is still in preview and the product team is continuously working to make it fully functional.

    Please accept this as the answer.

    Thank you for reaching out to the Microsoft Q&A Portal.


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.