Skip to content

fix: separate model deployment location from resource group location#8321

Merged
trangevi merged 2 commits into
Azure:mainfrom
v1212:fix/separate-model-deployment-location
May 22, 2026
Merged

fix: separate model deployment location from resource group location#8321
trangevi merged 2 commits into
Azure:mainfrom
v1212:fix/separate-model-deployment-location

Conversation

@v1212
Copy link
Copy Markdown
Collaborator

@v1212 v1212 commented May 22, 2026

Summary

Introduces AZURE_AI_DEPLOYMENTS_LOCATION env 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: Prefers AZURE_AI_DEPLOYMENTS_LOCATION, falls back to AZURE_LOCATION for backward compatibility
  • ensureLocation: Sets both AZURE_LOCATION (RG) and AZURE_AI_DEPLOYMENTS_LOCATION (model/project) to the same value by default
  • selectFoundryProject: Sets AZURE_AI_DEPLOYMENTS_LOCATION from the selected project's region
  • updateEnvLocation (model selector): Writes to AZURE_AI_DEPLOYMENTS_LOCATION only, leaving AZURE_LOCATION unchanged so RG location is preserved
  • Warning message uses generic wording instead of referencing a specific env var name

Companion PR

Related

@github-actions github-actions Bot added the ext-agents azure.ai.{agents,connections,inspector,projects,routines,skills,toolboxes} extensions label May 22, 2026
@v1212 v1212 force-pushed the fix/separate-model-deployment-location branch from 4402d22 to 9204a91 Compare May 22, 2026 03:46
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
@v1212 v1212 force-pushed the fix/separate-model-deployment-location branch from 9204a91 to e6087cd Compare May 22, 2026 03:50
@v1212 v1212 marked this pull request as ready for review May 22, 2026 05:25
Copilot AI review requested due to automatic review settings May 22, 2026 05:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (fallback AZURE_LOCATION) when loading Azure context for model/project operations.
  • Update location initialization to set both AZURE_LOCATION (RG) and AZURE_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_LOCATION without overwriting an existing AZURE_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.

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init_models.go
- 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
Copy link
Copy Markdown
Member

/check-enforcer override

@trangevi trangevi enabled auto-merge (squash) May 22, 2026 15:51
@trangevi trangevi merged commit 00f3d96 into Azure:main May 22, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-agents azure.ai.{agents,connections,inspector,projects,routines,skills,toolboxes} extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow developers to deploy when the Foundry project and resource group are in different regions

3 participants