Foundry IQ now integrates with Foundry Agent Service via MCP (Model Context Protocol), enabling developers to build AI agents grounded in enterprise knowledge.
This integration combines Foundry IQβs intelligent retrieval capabilities with Foundry Agent Serviceβs orchestration, enabling agents to retrieve and reason over enterprise data.
Key capabilities include:
- Auto-chunking of documents
- Vector embedding generation
- Permission-aware retrieval
- Semantic reranking
- Citation-backed responses
Together, these capabilities allow AI agents to retrieve enterprise knowledge and generate responses that are accurate, traceable, and aligned with organizational permissions.
Why Use Foundry IQ with Foundry Agent Service?
Intelligent Retrieval
Foundry IQ extends beyond traditional vector search by introducing:
- LLM-powered query decomposition
- Parallel retrieval across multiple sources
- Semantic reranking of results
This enables agents to retrieve the most relevant enterprise knowledge even for complex queries.
Permission-Aware Retrieval
Agents only access content users are authorized to see.
Access control lists from sources such as:
- SharePoint
- OneLake
- Azure Blob Storage
are automatically synchronized and enforced at query time.
Auto-Managed Indexing
Foundry IQ automatically manages:
- Document chunking
- Vector embedding generation
- Indexing
This eliminates the need to manually build and maintain complex ingestion pipelines.
The Three Pillars of Foundry IQ
1. Knowledge Sources
Foundry IQ connects to enterprise data wherever it lives β SharePoint, Azure Blob Storage, OneLake, and more.
When you add a knowledge source:
- Auto-chunking β Documents are automatically split into optimal segments
- Auto-embedding β Vector embeddings are generated without manual pipelines
- Auto-ACL sync β Access permissions are synchronized from supported sources (SharePoint, OneLake)
- Auto-Purview integration β Sensitivity labels are respected from supported sources2. Knowledge Bases
2. Knowledge Bases
A Knowledge Base unifies multiple sources into a single queryable index. Multiple agents can share the same knowledge base, ensuring consistent answers across your organization
3. Agentic Retrieval
Agentic retrieval is an LLM-assisted retrieval pipeline that:
- Decomposes complex questions into subqueries
- Executes searches in parallel across sources
- Applies semantic reranking
- Returns a unified response with citations
Agent β MCP Tool Call β Knowledge Base β Grounded Response with Citations
The retrievalReasoningEffort parameter controls LLM processing:
- minimal β Fast queries
- low β Balanced reasoning
- medium β Complex multi-part questions
Project Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FOUNDRY AGENT SERVICE β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββ β
β β Agent βββββΆβ MCP Tool βββββΆβ Project Connection β β
β β (gpt-4.1) β β (knowledge_ β β (RemoteTool + MI Auth) β β
β βββββββββββββββ β base_retrieve) βββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FOUNDRY IQ (Azure AI Search) β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β MCP Endpoint: β β
β β /knowledgebases/{kb-name}/mcp?api-version=2025-11-01-previewβ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββββββ β
β β Knowledge β β Knowledge β β Indexed Documents β β
β β Sources ββββ Base ββββ (auto-chunked, β β
β β (Blob, SP, etc) β β (unified index) β β auto-embedded) β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Prerequisites
Enable RBAC on Azure AI Search
az search service update --name your-search --resource-group your-rg \ --auth-options aadOrApiKey
Assign Role to Project's Managed Identity
az role assignment create --assignee $PROJECT_MI \ --role "Search Index Data Reader" \ --scope "/subscriptions/.../Microsoft.Search/searchServices/{search}"
Install Dependencies
pip install azure-ai-projects>=2.0.0b4 azure-identity python-dotenv requests
Connecting a Knowledge Base to an Agent
The integration requires three steps.
Connect Knowledge Base to Agent via MCP
The integration requires three steps:
- Create a project connection β Links your AI Foundry project to the knowledge base using ProjectManagedIdentity authentication
- Create an agent with MCPTool β The agent uses knowledge_base_retrieve to query the knowledge base
- Chat with the agent β Use the OpenAI client to have grounded conversations
Step 1: Create Project Connection
import requests
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
credential = DefaultAzureCredential()
PROJECT_RESOURCE_ID = "/subscriptions/.../providers/Microsoft.CognitiveServices/accounts/.../projects/..."
MCP_ENDPOINT = "https://{search}.search.windows.net/knowledgebases/{kb}/mcp?api-version=2025-11-01-preview"
def create_project_connection():
"""Create MCP connection to knowledge base."""
bearer = get_bearer_token_provider(credential, "https://management.azure.com/.default")
response = requests.put(
f"https://management.azure.com{PROJECT_RESOURCE_ID}/connections/kb-connection?api-version=2025-10-01-preview",
headers={"Authorization": f"Bearer {bearer()}"},
json={
"name": "kb-connection",
"properties": {
"authType": "ProjectManagedIdentity",
"category": "RemoteTool",
"target": MCP_ENDPOINT,
"isSharedToAll": True,
"audience": "https://search.azure.com/",
"metadata": {"ApiType": "Azure"}
}
}
)
response.raise_for_status()
Step 2: Create Agent with MCP Tool
from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import PromptAgentDefinition, MCPTool
def create_agent():
client = AIProjectClient(endpoint=PROJECT_ENDPOINT, credential=credential)
# MCP tool connects agent to knowledge base
mcp_kb_tool = MCPTool(
server_label="knowledge-base",
server_url=MCP_ENDPOINT,
require_approval="never",
allowed_tools=["knowledge_base_retrieve"],
project_connection_id="kb-connection"
)
# Create agent with knowledge base tool
agent = client.agents.create_version(
agent_name="enterprise-assistant",
definition=PromptAgentDefinition(
model="gpt-4.1",
instructions="""You MUST use the knowledge_base_retrieve tool for every question.
Include citations from sources.""",
tools=[mcp_kb_tool]
)
)
return agent, client
Step 3: Chat with the Agent
def chat(agent, client):
openai_client = client.get_openai_client()
conversation = openai_client.conversations.create()
while True:
question = input("You: ").strip()
if question.lower() == "quit":
break
response = openai_client.responses.create(
conversation=conversation.id,
input=question,
extra_body={
"agent_reference": {
"name": agent.name,
"type": "agent_reference"
}
}
)
print(f"Assistant: {response.output_text}")
More Information
Summary
The integration of Foundry IQ with Foundry Agent Service enables developers to build knowledge-grounded AI agents for enterprise scenarios.
By combining:
- MCP-based tool calling
- Permission-aware retrieval
- Automatic document processing
- Semantic reranking
organizations can build secure, enterprise-ready AI agents that deliver accurate, traceable responses backed by source data.