You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(agents): attach and authenticate every toolboxes reference - #10631
Fixes#10621. Referencing toolboxes on a Copilot-harness prompt agent was silently ignored during deployment, while the legacy singular toolbox field attached an unauthenticated MCP URL that failed at runtime with HTTP 401. This change retires singular toolbox and wires every toolboxes entry to an authenticated UserEntraToken project connection and MCP tool attachment.
Changes
schemas/azure.ai.agent.json & internal/pkg/agents/agent_yaml: Retire singular toolbox in favor of plural toolboxes ([]ToolboxReference) and reject singular or mixed toolbox/toolboxes configurations with migration guidance.
internal/project/prompt_skills.go & prompt_graph.go: Validate each toolboxes service dependency in promptGraph, parse the deployed toolbox name and version from TOOLBOX_<NAME>_MCP_ENDPOINT, create or reuse a compatible <toolboxName>-mcpRemoteTool (UserEntraToken, audience: https://ai.azure.com) connection via ARM, and link project_connection_id on each injected MCP tool.
internal/cmd/agent_dependency_plan.go & resource_services.go: Align init and file-backed dependency planning exclusively with plural toolboxes.
Manual Validation
Deployed a Copilot-harness prompt agent (harness.type: microsoft_copilot_preview) with one and two azure.ai.toolbox services (web_search) via azd deploy --all --no-prompt in westus2; confirmed via azd ai agent show --output json and ARM GET that <toolbox>-mcpUserEntraToken connections were created/reused and linked via project_connection_id on each MCP tool.
Invoked the deployed agent via azd ai agent invoke with built-in Copilot tools disabled (microsoft_copilot_toolset_previewdefaultConfig.enabled: false) and confirmed live MCP tool calls succeeded against both attached toolboxes without HTTP 401.
Verified azd deploy rejects singular toolbox, mixed toolbox + toolboxes, and missing uses entries with actionable error messages.
- Retire singular `toolbox` in favor of plural `toolboxes` across schema, validation, and dependency planning.
- Resolve each referenced `azure.ai.toolbox` MCP endpoint and version in `promptGraph`, ensure a compatible `UserEntraToken` project connection (`<toolbox>-mcp`), and link `project_connection_id` on each injected MCP tool.
Azure Pipelines:
Successfully started running 2 pipeline(s).
24 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.
- Reconcile prior toolbox version URLs in `reconcileMcpTool` and use `<toolbox>-v<version>-mcp` when `<toolbox>-mcp` points to another version.
- Resolve ARM account identity from `AZURE_AI_PROJECT_ID`, use replayable `req.SetBody` on connection PUTs, and propagate connection `` errors.
- Disambiguate `server_label` with the service key when multiple `toolboxes` entries share a toolbox resource name and track claimed `Tools` indices across `toolboxNode.Resolve`.
- Require HTTPS Foundry project URLs (`*.services.ai.azure.com/api/projects/<project>/...`) in `parseToolboxMCPEndpoint` before configuring `UserEntraToken` connections.
Parallel agent deployments attaching different versions of the same toolbox can both GET 404 for <toolbox>-mcp, then PUT different targets here. Both return that connection name, so the last PUT leaves one agent's server_url mismatched with its connection target. The version-scoped fallback never runs in this interleaving; services without mutual uses edges deploy in parallel (cli/azd/docs/concurrency-model.md:111–116). Use deterministic endpoint-specific names for new connections, or supported atomic create-if-absent behavior with compatibility checking on conflicts. Add coverage for concurrent first deployments.
The GET-then-PUT sequence can overwrite another agent's connection during parallel deployment. Two agents pinning different versions of the same toolbox can both receive 404 for <toolbox>-mcp, then PUT different targets and return the same connection name. The last write leaves one agent's server_url mismatched with its connection target. The version-scoped fallback only handles connections visible during GET. Services without mutual uses edges deploy in parallel (cli/azd/docs/concurrency-model.md:111–116). Use immutable endpoint-specific names from initial creation, or atomic creation with conflict rechecking, and add an interleaved first-deployment test.
The reason will be displayed to describe this comment to others. Learn more.
[azd-code-reviewer][HIGH] This error includes raw existingURL and mcpURL; the invalid-endpoint path below also prints ref.MCPEndpoint verbatim. These URLs can carry userinfo, SAS/sig query parameters, or fragments from authored or persisted configuration, leaking credentials into terminal and CI logs. Clear URL.User, RawQuery, Fragment, and RawFragment before formatting either error, and add a non-disclosure test with credential-bearing URLs.
The reason will be displayed to describe this comment to others. Learn more.
[azd-code-reviewer][HIGH] On an exact server_url match, a non-empty existing project_connection_id is preserved even when it names a missing or incompatible connection. The code has just ensured a UserEntraToken connection in projectConnectionID, but the published tool can keep pointing at stale auth and still fail with 401. Set project_connection_id to the ensured connection for every managed toolbox match while preserving unrelated options, and add coverage where an exact URL starts with a different non-empty connection ID.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #10621. Referencing
toolboxeson a Copilot-harness prompt agent was silently ignored during deployment, while the legacy singulartoolboxfield attached an unauthenticated MCP URL that failed at runtime with HTTP 401. This change retires singulartoolboxand wires everytoolboxesentry to an authenticatedUserEntraTokenproject connection and MCP tool attachment.Changes
schemas/azure.ai.agent.json&internal/pkg/agents/agent_yaml: Retire singulartoolboxin favor of pluraltoolboxes([]ToolboxReference) and reject singular or mixedtoolbox/toolboxesconfigurations with migration guidance.internal/project/prompt_skills.go&prompt_graph.go: Validate eachtoolboxesservice dependency inpromptGraph, parse the deployed toolbox name and version fromTOOLBOX_<NAME>_MCP_ENDPOINT, create or reuse a compatible<toolboxName>-mcpRemoteTool(UserEntraToken,audience: https://ai.azure.com) connection via ARM, and linkproject_connection_idon each injected MCP tool.internal/cmd/agent_dependency_plan.go&resource_services.go: Aligninitand file-backed dependency planning exclusively with pluraltoolboxes.Manual Validation
harness.type: microsoft_copilot_preview) with one and twoazure.ai.toolboxservices (web_search) viaazd deploy --all --no-promptinwestus2; confirmed viaazd ai agent show --output jsonand ARMGETthat<toolbox>-mcpUserEntraTokenconnections were created/reused and linked viaproject_connection_idon each MCP tool.azd ai agent invokewith built-in Copilot tools disabled (microsoft_copilot_toolset_previewdefaultConfig.enabled: false) and confirmed live MCP tool calls succeeded against both attached toolboxes without HTTP 401.azd deployrejects singulartoolbox, mixedtoolbox+toolboxes, and missingusesentries with actionable error messages.