An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
Hello, Welcome to MS Q&A
Based on my interpretation , Azure AI Search Knowledge Bases (Agentic Retrieval) currently expect the LLM to be a Microsoft Foundry/Azure OpenAI resource, accessed using the Search service's Managed Identity with the Cognitive Services User role. There is no documented support for configuring an APIM endpoint as the Knowledge Base LLM endpoint. Although APIM is supported for client applications calling Azure OpenAI, this support does not extend to the internal LLM calls made by Knowledge Bases for Answer Synthesis. Therefore, routing Knowledge Base LLM traffic through APIM is not a supported architecture today, which is likely the reason for the 401 error.
Microsoft Learn references:
- Query a Knowledge Base using Agentic Retrieval (Prerequisites, Managed Identity, LLM configuration)
- Agentic Retrieval Quickstart (Knowledge Base architecture and Answer Synthesis using Azure OpenAI/Foundry)
Any other solution what I can suggest
Option 1: Build a custom RAG pipeline
Instead of using the built-in Knowledge Base Answer Synthesis:
- Azure AI Search for retrieval
- Azure OpenAI via APIM for generation
- Optional orchestration with Azure AI Foundry Agent Service or Semantic Kernel
This provides the most flexibility and fully complies with the APIM requirement.
Option 2: Request Microsoft support
Since this appears to be a product limitation, ask Microsoft whether:
- APIM support for Knowledge Base LLM endpoints is on the roadmap.
- There is a private preview or undocumented supported configuration for APIM.
Pls check and let us know if any further ques
Thanks
Deepanshu