When clicking Connect on a custom MCP tool configured with OAuth Identity Passthrough, Azure AI Foundry returns a 500 error after ~10 seconds. The error originates from componentName: "account-rp" in Brazil South, before Foundry makes any outbound request to the MCP or OAuth server.
Error response body from POST https://ai.azure.com/nextgen/api/query?createOrUpdateConnectionResolver:
{
"error": {
"code": "ServiceError",
"message": "InternalServerError"
},
"correlation": {
"operation": "3fa794e836e54c5884cd081cb94ea351",
"request": "e0de6d5ce07e5d6b"
},
"environment": "brazilsouth",
"location": "brazilsouth",
"componentName": "account-rp",
"statusCode": 500
}
Proof the server is not the problem:
- Added request-logging middleware that fires on every incoming HTTP request
- Postman OAuth flow: logs appear, full flow completes successfully
- Foundry Connect: zero log entries - confirming Foundry never contacts the server
Server endpoints verified working:
-
/.well-known/oauth-authorization-server - 200, valid RFC 8414 JSON
-
/.well-known/openid-configuration - 200, valid OIDC JSON
-
OPTIONS /oauth/token with Origin: https://ai.azure.com - 204 with CORS headers
-
POST /oauth/token - responds correctly (tested with Postman, Claude Desktop)
-
/mcp - responds correctly when authenticated
I've read there are some issues regarding OAuth Identity Passthrough in Foundry's Agents custom MCP tools and I'd like to know if there is a fix.