Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform
Hello Emmanuel Jackson,
Welcome to Microsoft Q&A and Thanks again for the detailed troubleshooting,
Based on everything you’ve shared, this does not look like a client-side or basic configuration issue. The fact that:
- Agent creation succeeds
- Streaming starts normally
- The failure happens only when the Azure AI Search tool is invoked
- And it reproduces with both Managed Identity and API key authentication
strongly points to either a runtime-level issue in the Foundry Agent → Azure AI Search integration, or a connection/endpoint resolution issue that only surfaces at execution time.
This pattern is typically seen in a few specific scenarios:
1. Endpoint resolution issue at runtime
Even if the connection validates during setup, the agent runtime may:
- Resolve an incorrect or malformed endpoint
- Fail to reach the Search service internally
This results in:
openai.APIError: Invalid endpoint or connection failed
2. Connection object inconsistency
Sometimes the connection Looks valid in the SDK But is stale or not fully propagated to the runtime
This explains why Creation works, Execution fails
3. Schema / tool compatibility edge case
Even with a valid index, the agent runtime expects:
A clearly defined searchable text field (primary content)
Proper separation of text vs vector fields
Fields explicitly marked as:
-
searchable = true -
retrievable = true
If mapping is ambiguous, failure can occur only at execution time.
4. Backend limitation
Given Same failure across multiple resources, Same behavior with both auth types
This may indicate a service-side issue in Foundry Agent’s Search tool execution layer.
Additional checks
Please go through the following:
- Confirm Search endpoint format
Make sure your connection uses exactly:
https://<your-search-name>.search.windows.net
- No trailing
/ - No
/indexes/... - Correct service name and region
If using a Foundry knowledge base, ensure search_service_endpoint matches this exactly
2. Validate authentication and roles
If using Managed Identity:
Go to Azure Portal → Search resource → Access Control (IAM)
Assign Search Index Data Reader
If using API Key:
- Go to Keys tab in Search resource
- Ensure “API Key” or “Both” is enabled
- Re-copy the key and update the Foundry connection
3. Networking and TLS checks
Even if Azure shows “Allow all networks”:
- Corporate firewall / proxy may interfere
- TLS inspection can break connectivity
Ensure *.search.windows.net is allowlisted and No SSL interception is happening
4. Recreate the connection
- Delete the existing Azure AI Search connection
- Recreate it fresh
- Rebind it to the agent
This resolves many hidden/stale config issues.
5. Test connectivity outside the agent
Try a direct call using the same auth:
- List indexes
- Run a simple query
If this fails → issue is Search / network layer If this works → issue is Foundry runtime layer
6. Minimal index test
Create a simple test index with One text field (content) and One vector field
Ensure both are Searchable and Retrievable
This helps isolate schema-related issues.
7. Region alignment
Confirm Foundry project region, Azure AI Search region are compatible. Cross-region calls can fail at runtime.
8. Streaming vs non-streaming behavior
Since you’re using streaming Try a non-streaming call via SDK Or increase timeout
In rare cases Streaming sessions fail under longer execution paths
Please refer this
Connect a Foundry IQ knowledge base to Foundry Agent Service (Endpoint & 400/404 errors):
Foundry IQ FAQ (Auth methods & permission roles): https://learn.microsoft.com/en-us/azure/foundry/agents/concepts/foundry-iq-faq?wt.mc_id=knowledgesearch_inproduct_azure-cxp-community-insider
I Hope this helps. Do let me know if you have any further queries.
If this answers your query, please do click Accept Answer and Yes for was this answer helpful.
Thank you!