Skip to content

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

Open
Saswato-Microsoft wants to merge 4 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 4 commits into
microsoft:devfrom
Saswato-Microsoft:psl-aiproject-fix

Conversation

@Saswato-Microsoft
Copy link
Copy Markdown
Contributor

@Saswato-Microsoft Saswato-Microsoft commented May 15, 2026

Purpose

This pull request introduces comprehensive support for "Bring Your Own" (BYO) Azure AI Foundry Project resources, allowing deployments to reuse an existing Foundry project rather than provisioning a new one. The changes include new configuration parameters, environment variable handling, deployment logic, and updated documentation. Additionally, the documentation for reusing a Log Analytics Workspace has been refactored and moved into a dedicated guide for clarity.

Key changes include:

BYO Azure AI Foundry Project Support:

  • Added the existingAiProjectResourceId parameter to infra/main.bicep and infra/main.bicepparam, allowing users to specify an existing Foundry project resource ID. When set, the deployment skips creating new Foundry account/project resources and targets the existing project for downstream automation. [1] [2]
  • Updated parameter parsing and output logic in infra/main.bicep to handle the BYO Foundry project, including parsing resource ID segments and exposing relevant outputs such as aiFoundryProjectName, aiFoundryAccountName, aiFoundryResourceGroup, and aiFoundrySubscriptionId.
  • Modified deployment toggles in infra/main.bicepparam so that deployAiFoundry and deployAfProject are auto-disabled when BYO mode is active. [1] [2]
  • Enhanced scripts/preprovision-integrated.ps1 to detect and parse the BYO Foundry project resource ID, ensuring downstream automation and environment variables are set correctly for cross-subscription scenarios. [1] [2] [3]

Documentation Improvements:

  • Added a new guide, docs/re-use-foundry-project.md, with step-by-step instructions (including Azure Portal screenshots) for configuring deployments to reuse an existing Azure AI Foundry Project.
  • Updated the main deployment guide (docs/deploymentguide.md) to reference new dedicated guides for reusing both Foundry projects and Log Analytics workspaces, improving clarity and discoverability. [1] [2]
  • Added a new guide, docs/re-use-log-analytics.md, with detailed steps and visuals for reusing an existing Log Analytics Workspace.
  • Removed the lengthy inlined documentation for BYO Log Analytics workspace from docs/parameter_guide.md in favor of the new dedicated guide.

Parameter Table and Environment Variable Updates:

  • Added existingAiProjectResourceId to the parameter table in docs/deploymentguide.md, clarifying its purpose and associated environment variable.

These changes collectively make it much easier and safer to deploy into environments that already have existing Azure AI Foundry or Log Analytics resources, supporting cross-subscription scenarios and improving documentation for end users.

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 Outdated
Comment thread docs/parameter_guide.md Outdated
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 Outdated
Comment thread docs/deploymentguide.md Outdated
Comment thread docs/deploymentguide.md Outdated
Comment thread docs/parameter_guide.md Outdated
Copilot AI review requested due to automatic review settings May 18, 2026 12:10
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 7 out of 13 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

docs/parameter_guide.md:92

  • The Parameter Guide no longer documents how to configure BYO Log Analytics or the new BYO Foundry project (existingAiProjectResourceId / AZURE_EXISTING_AI_PROJECT_RESOURCE_ID). This conflicts with the PR description and leaves readers without a reference in this guide; either add the missing section(s) or update the PR description and include a link here to the new reuse guides.
---

## Table of Contents
1. [Basic Parameters](#basic-parameters)
2. [Deployment Toggles](#deployment-toggles)
3. [Network Configuration](#network-configuration)
4. [Microsoft Foundry Configuration](#microsoft-foundry-configuration)
5. [Individual Service Configuration](#individual-service-configuration)
6. [Common Customization Examples](#common-customization-examples)

Comment on lines +17 to +27
![alt text](../docs/images/re_use_log/logAnalyticsList.png)

### 3. Copy Resource ID

In the **Overview** pane, click on **JSON View**.

![alt text](../docs/images/re_use_log/logAnalytics.png)

Copy the **Resource ID** that is your Workspace ID.

![alt text](../docs/images/re_use_log/logAnalyticsJson.png)
Comment on lines +15 to +43
In the search bar at the top, type "Azure AI Foundry" and click on it. Then select the Foundry service instance where your project exists.

![alt text](../docs/images/azure_ai_foundry_list.png)

### 3. Navigate to Projects under Resource Management

On the left sidebar of the Foundry service blade:

- Expand the **Resource Management** section
- Click on **Projects** (this refers to the active Foundry project tied to the service)

### 4. Click on the Project

From the Projects view: Click on the project name to open its details.

> **Note:** You will see only one project listed here, as each Foundry service maps to a single project in this accelerator.

![alt text](../docs/images/navigate_to_projects.png)

### 5. Copy Resource ID

In the left-hand menu of the project blade:

- Click on **Properties** under **Resource Management**
- Locate the **Resource ID** field
- Click on the copy icon next to the Resource ID value

![alt text](../docs/images/project_resource_id.png)

Comment thread infra/main.bicep
output keyVaultResourceId string = effectiveKeyVaultResourceId
output storageAccountResourceId string = effectiveStorageAccountResourceId
output aiFoundryProjectName string = aiFoundryProjectName
output aiFoundryProjectName string = effectiveAiFoundryProjectName
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.

4 participants