Skip to main content
The web search tool in Foundry Agent Service enables the agent’s Foundry model to retrieve and ground responses with real-time information from the public web before generating output. When enabled, the model can return up-to-date answers with inline citations, helping you build agents that provide current, factual information to users.
  • Web Search uses Grounding with Bing Search and Grounding with Bing Custom Search, which are First Party Consumption Services governed by these Grounding with Bing terms of use and the Microsoft Privacy Statement.
  • The Microsoft Data Protection Addendum doesn’t apply to data sent to Grounding with Bing Search and Grounding with Bing Custom Search. When you use Grounding with Bing Search and Grounding with Bing Custom Search, data transfers occur outside compliance and geographic boundaries.
  • Use of Grounding with Bing Search and Grounding with Bing Custom Search incurs costs. See pricing for details.
  • See the management section for information about how Azure admins can manage access to use of web search.
Consider adding this tool using a toolbox. By using a toolbox, you are able to reuse the tool across agents and runtimes, as well as centralizing credential management, versioning, and policy enforcement through a managed MCP endpoint. See the toolbox quickstart.
Usage support The following table shows SDK and setup support.

Prerequisites

The Foundry RBAC roles were recently renamed. Foundry User, Foundry Owner, Foundry Account Owner, and Foundry Project Manager were previously named Azure AI User, Azure AI Owner, Azure AI Account Owner, and Azure AI Project Manager. You might still see the previous names in some places while the rename rolls out. The role IDs and core permissions are unchanged by the rename.
  • Foundry Project Manager role on the Foundry project if you create the remote-tool project connection for domain-restricted search.
  • Azure credentials configured for authentication (such as DefaultAzureCredential).
  • Your Foundry project endpoint URL and a model deployment name.

Choose a web grounding scenario

Add web search directly to an agent

Start with the Prompt Agents tab. It adds WebSearchTool directly to a server-side agent and doesn’t require a toolbox or a separate Bing project connection. This path provides the shortest route to a grounded response with citations. The Hosted Agents tab uses WebSearchToolboxTool to add web search to a toolbox, then connects to the toolbox MCP endpoint. Keep the direct-agent and toolbox tool types separate because they apply to different API surfaces.
For information on optimizing tool usage, see best practices.

Configure the web search tool

You can configure web search behavior when you create your agent.

Web search response format over MCP

When Web Search returns results over MCP, the response is a resource content item containing the synthesized answer with inline Markdown source links. URL citations are in content[].resource._meta.annotations[]. For example:
  • user_location: Helps web search return results relevant to a user’s geography. Use an approximate location when you want results localized to a country/region/city.
  • search_context_size: Controls how much context window space to use for the search. Supported values are low, medium, and high. The default is medium.

Security and privacy considerations

  • Treat web search results as untrusted input. Validate and sanitize data before you use it in downstream systems.
  • Avoid sending secrets or sensitive personal data in prompts that might be forwarded to external services.
  • Review the terms, privacy, and data boundary notes in the preview section of this article before enabling web search in production.

Known limitations

For information about web search behavior and limitations in the Responses API, see Web search with the Responses API.

Troubleshooting

Administrator control for the web search tool

You can enable or disable the web search tool in Foundry Agent Service at the subscription level by using Azure CLI. This setting applies to all accounts within the specified subscription.

Prerequisites

Before running the following commands, make sure that you:
  1. Have Azure CLI installed.
  2. Are signed in to Azure by using az login.
  3. Activate Contributor at subscription scope just in time through Microsoft Entra PIM. Subscription scope is required because this setting applies to all Foundry resources in the subscription. Deactivate the role after changing the setting. Day-to-day agent developers and runtime users don’t need this role.
To disable the web search tool for all accounts in a subscription, run the following command:
This command disables web search across all accounts in the specified subscription. To enable the web search tool, run the following command:
This command enables web search functionality for all accounts in the subscription.

Next steps

Review tool best practices

Set up an agent environment