fix: separate model deployment location from resource group location#8321
Merged
trangevi merged 2 commits intoMay 22, 2026
Merged
Conversation
4402d22 to
9204a91
Compare
Introduce AZURE_AI_DEPLOYMENTS_LOCATION env var to decouple model/project deployment location from the resource group location (AZURE_LOCATION). When a user selects a model from a different region during init, only AZURE_AI_DEPLOYMENTS_LOCATION is updated, preserving AZURE_LOCATION for the resource group. This prevents provisioning failures when the Foundry project and resource group are in different regions. Fixes Azure#7670 Supersedes Azure#7873
9204a91 to
e6087cd
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the azure.ai.agents extension’s init/model-selection flows to decouple the location used for AI model/project deployments from the resource group location by introducing and preferring AZURE_AI_DEPLOYMENTS_LOCATION (with fallback to AZURE_LOCATION for compatibility).
Changes:
- Prefer
AZURE_AI_DEPLOYMENTS_LOCATION(fallbackAZURE_LOCATION) when loading Azure context for model/project operations. - Update location initialization to set both
AZURE_LOCATION(RG) andAZURE_AI_DEPLOYMENTS_LOCATION(AI deployments) by default, and adjust messaging to be less env-var-specific. - Ensure project/model selection flows write
AZURE_AI_DEPLOYMENTS_LOCATIONwithout overwriting an existingAZURE_LOCATION.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_models.go | Writes selected model/deployment region to AZURE_AI_DEPLOYMENTS_LOCATION and updates success/error messaging accordingly. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers.go | Adds AZURE_AI_DEPLOYMENTS_LOCATION preference in context loading; updates location ensuring and project selection to avoid clobbering RG location. |
- ensureLocation fast-path now seeds AZURE_LOCATION when unset, preventing provisioning failures if only AZURE_AI_DEPLOYMENTS_LOCATION was configured. - Add TestUpdateEnvLocation covering env var persistence and azureContext update.
trangevi
approved these changes
May 22, 2026
Member
|
/check-enforcer override |
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.
Summary
Introduces
AZURE_AI_DEPLOYMENTS_LOCATIONenv var to decouple model/project deployment location from the resource group location (AZURE_LOCATION), fixing provisioning failures when a Foundry project and resource group are in different regions.Changes
loadAzureContext: PrefersAZURE_AI_DEPLOYMENTS_LOCATION, falls back toAZURE_LOCATIONfor backward compatibilityensureLocation: Sets bothAZURE_LOCATION(RG) andAZURE_AI_DEPLOYMENTS_LOCATION(model/project) to the same value by defaultselectFoundryProject: SetsAZURE_AI_DEPLOYMENTS_LOCATIONfrom the selected project's regionupdateEnvLocation(model selector): Writes toAZURE_AI_DEPLOYMENTS_LOCATIONonly, leavingAZURE_LOCATIONunchanged so RG location is preservedCompanion PR
Related