A fully managed platform in Microsoft Foundry for hosting, scaling, and securing AI agents built with any supported framework or model
Thanks — your suggestion to test the MCP endpoint independently with an Entra bearer token was the right call, and it settled the case. Posting the result because it changes the diagnosis substantially.
The MCP endpoint reproduces the failure with no Foundry agent in the chain.
Repro is three calls against the knowledge base MCP endpoint, authenticated with an Entra token for https://search.azure.com:
TOKEN=$(az account get-access-token --resource "https://search.azure.com" --query accessToken -o tsv)
MCP="https://<search-service>.search.windows.net/knowledgebases/<kb>/mcp?api-version=2026-05-01-preview"
H=(-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream")
# 1) handshake -> HTTP 200, valid serverInfo
curl -sS -X POST "$MCP" "${H[@]}" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}'
# 2) tools/list -> HTTP 200, tool schema returned
curl -sS -X POST "$MCP" "${H[@]}" -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
# 3) tools/call -> isError:true, the endpoint-validation message
curl -sS -X POST "$MCP" "${H[@]}" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"knowledge_base_retrieve","arguments":{"queries":["<query>"]}}}'
Steps 1 and 2 succeed, so Entra auth against the MCP endpoint is fine. Step 3 returns:
An error occurred invoking 'knowledge_base_retrieve': BadRequest
{"Message":"Only Azure OpenAI and Azure AI Foundry endpoints are supported for Knowledge
Base model configurations. API Management (APIM) and custom domain endpoints are not
supported.", "DataPlaneErrorCode":5, ...}
Side-by-side, same knowledge base, same moment:
| Call | Result |
|---|---|
POST /retrieve with intents input (admin key or Entra token) |
HTTP 200, correct grounded content |
| -------- | -------- |
POST /retrieve with intents input (admin key or Entra token) |
HTTP 200, correct grounded content |
POST /mcp → tools/call knowledge_base_retrieve with queries (Entra token) |
error, message above |
What this rules out. My earlier hypothesis — that the failure came from the Foundry project's parent resource being of kind AIServices, so the model endpoint resolved to *.cognitiveservices.azure.com / *.services.ai.azure.com — is wrong. You were right to question it, and right about the reason: no documentation supported it. The defect reproduces with no Foundry involvement at all.
I also tested the follow-up hypothesis that the queries input requires query planning unavailable at retrievalReasoningEffort: minimal. Raised the effort to low, confirmed via GET on the knowledge base, re-ran step 3: fails identically. So the reasoning effort is not the factor either.
Current state of the invariance. The tools/call failure is unchanged across: three endpoint hostnames, two Azure OpenAI resources (one kind: OpenAI, one kind: AIServices), two model deployments (gpt-4o, gpt-5.4-mini), three credential forms (apiKey set / explicit null / fields absent → system-assigned MI), and two reasoning-effort levels. The knowledge base configuration currently in place returns HTTP 200 on POST /retrieve.
Secondary finding, possibly relevant. tools/list reports the tool's input schema as queries — "1 to 3 search queries. Each query: max 150 characters; under 12 words." Not intents, not messages. So the MCP path and the REST path take different inputs, and only the MCP one fails. If the MCP handler converts queries into an internal retrieval request, that conversion looks like the place where the model configuration is re-resolved and rejected.
The question, narrowed to one: why does the MCP tools/call path reject a knowledge base model configuration that POST /retrieve accepts, on the same knowledge base?
RequestIds from the direct MCP calls (no agent involved):
9e1e1c7b-2a9e-4f2f-8c4c-2d41c1584414
5b0c2886-b72e-4f2c-9713-e740ffffc212
cd58c2c2-2185-412b-b710-dff4cf2f29ed
Region Sweden Central, api-version 2026-05-01-preview throughout. Happy to share the full knowledge base definition, connection config and the earlier nine RequestIds privately if a moderator needs them.
For anyone hitting this: the workaround that restored our agent is to drop the Foundry IQ attachment and call POST /retrieve directly as an OpenAPI tool with intents input, which is unaffected.