Repository navigation
fix(toolbox): prepare Foundry access before deploy and create - #10739
Travis Angevine (trangevi) wants to merge 4 commits into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 26 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Rebased onto the updated
|
1d55dbc to
8808f40
Compare
Limit access preparation to managed deployment and standalone create after local validation and before remote connection resolution. Reuse shared probe-first policy with verified project scope, user-tenant credentials, cancellation, and stderr progress. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Cache the verified GetToolbox probe response for one-time reuse by the immediate write operation. - Guard expandToolboxValue map type assertions when a tool entry is nil.
188fcb8 to
45c279f
Compare
|
Rebased onto |
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
There was a problem hiding this comment.
🟡 Changes recommended
Access preparation can grant unnecessary permissions before checking access, while managed deployments hide progress and administrator remediation warnings.
2 open issues
What changed in this PR
Integrates shared Foundry access preparation into toolbox deployment and standalone creation to address #10718 without relying on an agent predeploy hook. This is layer 2 of the stack and remains gated on a published core helper and dependency update.
Changes:
- Adds endpoint/scope binding, tenant resolution, and access-preparation wiring.
- Moves local validation before remote operations and adds regression coverage.
- Updates access guidance, structured 403 suggestions, help text, and dependency checksums.
| File | Description |
|---|---|
cli/azd/extensions/azure.ai.toolboxes/README.md |
Documents access behavior, validation, opt-out, and release sequencing. |
cli/azd/extensions/azure.ai.toolboxes/internal/exterrors/errors.go |
Adds actionable Foundry access guidance for 403 responses. |
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_create.go |
Validates definitions before access preparation and remote calls. |
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_create_test.go |
Tests duplicate authored and resolved tool names. |
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_access.go |
Adds the shared-access adapter and probe-result caching. |
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_access_test.go |
Covers access wiring, validation, tenant binding, diagnostics, and cancellation. |
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/testdata/TestAIHelp-root.snap |
Updates root help expectations for access preparation. |
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/testdata/TestAIHelp-create.snap |
Updates create help expectations for access diagnostics. |
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/service_target.go |
Prepares managed-deployment access before connection resolution. |
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/root.go |
Describes automatic access preparation in root help. |
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/context.go |
Adds write-specific client resolution and shared tenant lookup. |
cli/azd/extensions/azure.ai.toolboxes/go.sum |
Records authorization SDK checksums. |
cli/azd/extensions/azure.ai.toolboxes/go.mod |
Adds the authorization SDK dependency. |
Review effort: Balanced
| environment: client.Environment(), | ||
| account: client.Account(), | ||
| newCredential: foundry.NewCredential, | ||
| writer: os.Stderr, |


Stack
Layer 2 of 3, depends on #10738 (
trangevi/foundry-core-access, verified base commit143bfc5962613ca79a8b41d208f3246d3762b900). This is the issue-targeted slice of original #10736, extracted from verified immutable source commit7aa122c50ff86fabe45add0846353231bceb1319while preserving newer base changes. The broader consumer changes are intentionally reserved for layer 3. Original #10736 is unchanged.Fixes: #10718
Scope
azure.ai.toolboxdeployment and standaloneazd ai toolbox create, after locally checkable input validation and before remote connection resolution or mutation. This works independently of the dependent agent's predeploy hook.pkg/foundry.AccessPreparation: actual read probe first (404 means authorized), confirmed authorization denial before inherited/equivalent role inspection, conditional project-scoped Foundry User assignment, bounded post-grant readiness, and cancellation propagation.The endpoint-aware adapter is retained rather than adopting #10737's context-only ensure callback: orchestration must verify the selected endpoint/scope before selecting the credential tenant. A context-only callback would hide or duplicate that binding. No factory, manager, or global access cache was introduced.
Intentionally unchanged
No core edits, agents-extension migration, connection/skill add/remove access preparation, publish access preparation, read/delete role grants, local-authoring grants, bring-your-own endpoint grants, provisioning grants, or broad architecture/contributor documentation changes. The existing local credential file is retained; no gratuitous cleanup. Pure shared policy tests remain in the core layer.
Release/dependency gate
Keep draft / do not merge or release the extension until the core helper from #10738 is released and this extension's azd dependency is bumped to that released semver. The extension still pins
github.com/azure/azure-dev/cli/azd v1.37.0, which does not contain these new APIs. Validation uses an external session-artifactGOWORKcontaining this checkout's core and toolbox modules withGOTOOLCHAIN=go1.26.4. No workspace, localreplace, pseudo-version, or invented release version is committed. Only the directly needed authorization/v2 SDK dependency and checksums are added.Validation
All with Go 1.26.4 and the external workspace:
go test ./... -count=1andgo buildpassed.go vet ./internal/cmd ./internal/exterrors,go fix -diff ./internal/cmd ./internal/exterrors(no diff), andgolangci-lint run ./internal/cmd/... ./internal/exterrors/...passed (0 issues).git diff --checkpassed.Initial local failures from a blanket NO_COLOR override in the existing color-specific help test and a test listener double-close were corrected before the final clean full-suite run.