Share via

Is this true: Grounding with Bing Search is NOT programmatically callable via azure-ai-agents

Alex McGuinness 0 Reputation points
2026-01-20T14:32:07.69+00:00

Grounding with Bing Search is NOT programmatically callable via azure-ai-agents today

 

This is not documented clearly, but it is now confirmed by:

SDK behaviour

Error type

Azure support responses

exact symptoms

The SDK cannot see or bind the grounding connection you created in the portal.

Details:

Objective

data-enrichment for company names using Azure AI Foundry Agents with Grounding with Bing Search, triggered programmatically from Python.

The goal is to:

Query Bing Search via Foundry Agents

Retrieve authoritative public web data (company websites, social profiles, phone/email, addresses)

Populate structured enrichment fields in Excel/CSV outputs

Enforce strict “no hallucination” / “not found if uncertain” behaviour


Environment

Azure AI Foundry

Grounding with Bing Search (configured via Azure Portal → Connected resources)

azure-ai-projects SDK v1.0.0

azure-ai-agents SDK v1.1.0

Python 3.13 (Windows)

Agent creation and execution via AIProjectClient


Expected Behaviour

Python script should be able to:

Create or reuse an agent

  Bind the “Grounding with Bing Search” connection
  
     Execute grounded Bing queries
     
        Receive grounded results (with citations)
        
           Populate enrichment fields programmatically
           

This behaviour works in the Foundry Playground UI, so the assumption is that the SDK should support the same capability.


Actual Behaviour / Symptoms

1. Agent creation succeeds, but tool execution fails

Agent creation via SDK succeeds, but every Bing-grounded run fails with:

tool_user_error
invalid_tool_input
The specified connection ID '<connection>' was not found in the project or account connections

This occurs regardless of:

Using the full ARM connection ID

Using the short connection name

Logging confirms the correct value is read from environment variables


2. SDK silently ignores the provided Bing connection

Even when the script logs:

BING_CONNECTION_ID = [instance name] Using connection name as provided: [instance name] 

The runtime error shows the SDK attempting to resolve the project root instead:

.../accounts/<resource>/projects/<project>

This proves the connection parameter is not actually bound at runtime.


3. Attempting to bind connections explicitly is unsupported

Passing:

connections={ "bing_search": bing_conn }

into create_agent() causes:

TypeError: Session.request() got an unexpected keyword argument 'connections'

This confirms:

The installed SDK does not support connection binding

The HTTP client rejects the argument

The SDK documentation and examples are inconsistent with the released package


4. Behaviour differs from Playground

Playground: Bing grounding works

SDK: Bing grounding fails consistently

This indicates:

Playground injects connections internally

SDK cannot see or bind the same connection


Tests and Troubleshooting Performed

Verified connection exists in Azure Portal → Connected resources

Tested both:

Full ARM connection ID

  Short connection name
  
  Confirmed environment variables are read correctly
  
  Confirmed agent reuse vs forced recreation
  
  Tried multiple agent names / versions
  
  Removed all client-side validation checks
  
  Validated no Python scoping or indentation errors
  
  Confirmed authentication via Entra ID (device login)
  
  Confirmed SDK versions and compatibility
  
  Confirmed errors originate from tool execution phase, not agent creation
  

Azure Support / Community Feedback

Azure support response confirms:

Foundry Agents do not expose configuration switches (citations, strict grounding, etc.)

Bing grounding is implicitly invoked

There is no UI or SDK control to force strict grounding

SDK tooling is limited and behaviour differs from Playground

Recommendation was to use:

Prompt instructions as a workaround

  Bing Custom Search for programmatic use
  

This aligns with observed behaviour.


Root Cause (Conclusion)

The Azure AI Foundry SDK cannot see or bind the “Grounding with Bing Search” connection created in the Azure Portal.

Specifically:

Grounding with Bing Search appears to be UI-only

The SDK does not expose a supported mechanism to attach or reference the connection at runtime

The agent falls back to the project root instead of a valid Bing connection

This results in consistent invalid_tool_input errors

This is a platform limitation, not a client-side bug.


Why This Cannot Be Fixed Client-Side

No supported SDK parameter exists to bind Bing grounding

connections= is rejected at the transport layer

Tool configuration is opaque and undocumented

Playground behaviour cannot be replicated programmatically

Error occurs after successful authentication and agent creation

All reasonable configuration permutations have been tested


Impact

Grounding with Bing Search cannot be used programmatically

Automation pipelines cannot rely on Foundry Agents for enrichment

Only manual Playground usage is currently viable

Forces abandonment of Foundry for deterministic enrichment workflows


Request to Azure

Clarification is requested on:

Whether Grounding with Bing Search is intended to be SDK-usable

If so, how connections are meant to be bound programmatically

If not, confirmation that it is Playground-only

Whether SDK support is planned or deprecated


Bing | Bing Search APIs | Bing Web Search API

1 answer

Sort by: Most helpful
  1. Manas Mohanty 16,835 Reputation points Microsoft External Staff Moderator
    2026-02-02T10:40:47.4633333+00:00

    Hi

    I have used below packages with sample code available in official document.

    # Dependencies for the Bing grounding smoke test
    # Install: python -m pip install -r requirements.txt
    
    azure-identity>=1.17.1,<2.0
    azure-ai-projects==2.0.0b2
    azure-ai-agents==1.2.0b5
    python-dotenv>=1.0.1,<2.0
    
    
    
    

    User's image

    Steps

    Please install the requirment.txt

    export AZURE_AI_PROJECT_ENDPOINT="https://<projectname>.services.ai.azure.com/api/projects/testfoundry19" 
    
    export BING_PROJECT_CONNECTION_ID="/subscriptions/<subid>/resourceGroups/JanRG2/providers/Microsoft.CognitiveServices/accounts/TestfoundryAgentmm19/projects/testfoundry19/connections/advancedgroundingfilter" 
    
    export AZURE_AI_MODEL_DEPLOYMENT_NAME="gpt-4o"  
    echo "azure-ai-projects" >> requirement.txt 
    echo "python-dotenv" >> requirement.txt 
    echo "azure-identity" >> requirement.txt  
    
    
    python -m pip install -r requirement.txt
    
    
    

    Please fix the typo here from official document before running "python3 agent.py" ( Have created a bug item to update the typo in documentation)

    with project_client:   
     connection_id = os.environ["BING_PROJECT_CONNECTION_ID"]    
     print(f"Grounding with Bing Search connection ID: {connection_id}")
    
    
    

    Hope it helps.

    Thank you.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.