Skip to content

fix: Add support for reusing existing Azure AI Foundry projects in deployment#157

Open
Saswato-Microsoft wants to merge 2 commits into
microsoft:devfrom
Saswato-Microsoft:psl-aiproject-fix
Open

fix: Add support for reusing existing Azure AI Foundry projects in deployment#157
Saswato-Microsoft wants to merge 2 commits into
microsoft:devfrom
Saswato-Microsoft:psl-aiproject-fix

Conversation

@Saswato-Microsoft
Copy link
Copy Markdown
Contributor

Purpose

This pull request adds comprehensive support for Bring Your Own (BYO) Azure AI Foundry Project, allowing deployments to target an existing Foundry account and project—including those in different subscriptions—rather than always creating new ones. The changes span documentation, parameterization, Bicep infrastructure, and pre-provisioning scripts to enable this flexibility, ensure correct environment variable propagation, and update downstream automation accordingly.

BYO AI Foundry Project Support

  • Added the existingAiProjectResourceId parameter to infra/main.bicep and infra/main.bicepparam, allowing users to specify the full ARM resource ID of an existing AI Foundry project. When set, the deployment skips creating new Foundry account/project resources and targets the existing project for all downstream automation. Cross-subscription resource IDs are supported. [1] [2]
  • Updated Bicep logic to parse the existing project resource ID into its subscription, resource group, account, and project components, and output these for use by post-provisioning scripts and external automation.
  • Modified deployment toggles so that when BYO mode is active, deployAiFoundry, deployAfProject, and deployAAfAgentSvc are automatically disabled, preventing unnecessary resource creation. [1] [2]

Automation and Scripting Enhancements

  • Updated scripts/preprovision-integrated.ps1 to detect and parse AZURE_EXISTING_AI_PROJECT_RESOURCE_ID, set the appropriate environment variables, and ensure downstream automation targets the correct (possibly cross-subscription) Foundry project. [1] [2] [3]

Documentation Updates

  • Expanded docs/deploymentguide.md and added a new section to docs/parameter_guide.md detailing how to use the BYO AI Foundry Project feature, including parameter descriptions, setup instructions, and output references. [1] [2] [3]

These changes make it much easier to reuse centrally governed or pre-existing AI Foundry projects, especially in complex enterprise environments with multiple subscriptions and resource groups.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify that the following are valid

  • ...

Other Information

…ployment

Co-authored-by: Copilot <copilot@github.com>
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

Adds “Bring Your Own” (BYO) Azure AI Foundry project support so deployments can target an existing Foundry account/project (including cross-subscription), instead of always provisioning new Foundry resources.

Changes:

  • Introduces existingAiProjectResourceId input and outputs parsed Foundry account/project/RG/subscription details from that resource ID.
  • Updates preprovisioning to parse AZURE_EXISTING_AI_PROJECT_RESOURCE_ID and publish the correct azd env values for downstream automation.
  • Expands deployment docs/parameter guide with BYO AI Foundry usage and output references.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/preprovision-integrated.ps1 Detects/parses an existing AI Foundry project resource ID and sets azd env values for cross-RG/sub usage.
infra/main.bicepparam Reads AZURE_EXISTING_AI_PROJECT_RESOURCE_ID, passes it to main.bicep, and conditionally disables Foundry/project deployment toggles.
infra/main.bicep Adds existingAiProjectResourceId param, parses segments into outputs, and emits BYO-related outputs.
docs/parameter_guide.md Documents BYO AI Foundry behavior, setup, permissions, and outputs.
docs/deploymentguide.md Adds BYO AI Foundry parameter guidance and example azd env set usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread infra/main.bicepparam Outdated
Comment thread infra/main.bicep
Comment thread docs/parameter_guide.md
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 15, 2026 11:04
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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread infra/main.bicepparam
Comment thread scripts/preprovision-integrated.ps1
Comment thread infra/main.bicep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants