Validate tenant ID match against subscription's actual tenant in agent init - #6997
Merged
Travis Angevine (trangevi) merged 2 commits intoMar 4, 2026
Conversation
Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix agent init issues based on review feedback
Validate tenant ID match against subscription's actual tenant in agent init
Mar 4, 2026
Travis Angevine (trangevi)
approved these changes
Mar 4, 2026
Travis Angevine (trangevi)
marked this pull request as ready for review
March 4, 2026 19:20
Travis Angevine (trangevi)
merged commit Mar 4, 2026
48e9bc7
into
trangevi/autorun-improvements
13 checks passed
Travis Angevine (trangevi)
added a commit
that referenced
this pull request
Mar 5, 2026
…lot/CICD scenarios (#6980) * Some default handling updates for `azd ai agent init` Signed-off-by: trangevi <trangevi@microsoft.com> * Add support for new parameter for an existing model deployment Signed-off-by: trangevi <trangevi@microsoft.com> * Fix surfacing of noPrompt Signed-off-by: trangevi <trangevi@microsoft.com> * Add proper tenant handling for -p scenario Signed-off-by: trangevi <trangevi@microsoft.com> * Add model parameter as well so the model default isn't necessarily implicit Signed-off-by: trangevi <trangevi@microsoft.com> * Update cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * code comments Signed-off-by: trangevi <trangevi@microsoft.com> * Unit testability for noprompt model selection Signed-off-by: trangevi <trangevi@microsoft.com> * Validate tenant ID match against subscription's actual tenant in agent init (#6997) * Initial plan * Return validation error on tenant ID mismatch in agent init Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com> * Lint fix? Signed-off-by: trangevi <trangevi@microsoft.com> --------- Signed-off-by: trangevi <trangevi@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When
AZURE_TENANT_IDwas already set in the azd environment, tenant resolution was skipped entirely — meaning a stale or mismatched tenant could silently cause auth failures when targeting a Foundry project in a different tenant.Changes
exterrors/codes.go: AddedCodeTenantMismatch = "tenant_mismatch"to validation error codes.cmd/init.go:LookupTenantnow runs unconditionally. After the lookup:AZURE_TENANT_ID→ set from lookup (unchanged behavior)AZURE_TENANT_IDthat differs from the subscription's tenant → return aValidationerror, consistent with the existingsubscription_mismatch/location_mismatchpattern:✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.