Unable to use azure Grounding with bing search with azure ai agent in python, Getting Resource not found error.

Srija Lingamgunta 0 Reputation points
2025-07-03T10:10:14.6+00:00

I am having issues when trying to run this code:

https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-agents/samples/agents_tools/sample_agents_bing_grounding.py

I am getting an error 404 resource not found.

Traceback (most recent call last):
  File "C:\Users\Downloads\bingtest\binggrounding.py", line 30, in <module>
    agent = agents_client.create_agent(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Downloads\bingtest\myenv\Lib\site-packages\azure\core\tracing\decorator.py", line 119, in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Downloads\bingtest\myenv\Lib\site-packages\azure\ai\agents\_patch.py", line 294, in create_agent
    new_agent = super().create_agent(
                ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Downloads\bingtest\myenv\Lib\site-packages\azure\core\tracing\decorator.py", line 119, in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Downloads\bingtest\myenv\Lib\site-packages\azure\ai\agents\operations\_operations.py", line 5308, in create_agent
    map_error(status_code=response.status_code, response=response, error_map=error_map)
  File "C:\Users\Downloads\bingtest\myenv\Lib\site-packages\azure\core\exceptions.py", line 163, in map_error
    raise error
azure.core.exceptions.ResourceNotFoundError: (404) Resource not found
Code: 404
Message: Resource not found

I have AI foundry resource in my Azure and I created Grounding with bing search resource. I connected the Grounding with Bing search resource in connected resources tab of Azure AI foundry resource.i have used the below string for Azure Bing Connection Id in my environmental variables.

/subscriptions/<your_subscription_id>/resourceGroups/<your_resource_group>/providers/Microsoft.CognitiveServices/accounts/<ai_service_name>/projects/<foundry-project-name>/connections/<connection_name_created_above>

I have used "ai_service_name" same as resource name(?) Is that right?

This is my AI foundry resource. I used Azure AI inference endpoint as Project Endpoint.

User's image

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,653 questions
{count} votes

Your answer

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