Skip to content

chore: Reuse existing AIFoundry project#151

Closed
Shreyas-Microsoft wants to merge 7 commits intomainfrom
psl-use-existing-project
Closed

chore: Reuse existing AIFoundry project#151
Shreyas-Microsoft wants to merge 7 commits intomainfrom
psl-use-existing-project

Conversation

@Shreyas-Microsoft
Copy link
Copy Markdown
Collaborator

Purpose

This pull request introduces functionality to support the reuse of existing AI project resources in Azure deployments. The changes primarily involve updating Bicep templates to enable conditional handling of existing AI project resource IDs, ensuring compatibility with projects across different resource groups. Below are the most important changes grouped by theme:

Parameter Additions and Updates

  • Added a new parameter azureExistingAIProjectResourceId in infra/main.bicep and infra/modules/ai-foundry/main.bicep to allow specifying an existing AI project resource ID. This parameter is optional and supports reuse of resources across different resource groups. [1] [2]
  • Updated infra/main.parameters.json to include the new parameter azureExistingAIProjectResourceId for configuration.

Conditional Logic for Resource Handling

  • Introduced conditional logic in infra/modules/ai-foundry/project.bicep to extract components (e.g., project name, subscription ID) from the existing AI project resource ID and determine whether to use an existing project or create a new one.
  • Modified resource declarations (cogServiceReference, aiProject) to conditionally create new AI projects only when the azureExistingAIProjectResourceId parameter is not provided.

Role Assignments for AI Projects

  • Added conditional modules for role assignments:
    • newProjectRoleAssignments for new AI projects.
    • existingProjectRoleAssignments for existing AI projects from different resource groups. This ensures proper role assignment and telemetry handling. (F9f1e137L69R96, infra/modules/ai-foundry/project.bicepR99-R122)

Output Adjustments

  • Updated output variables (name, resourceId, apiEndpoint) in infra/modules/ai-foundry/project.bicep to dynamically reflect whether a new AI project is created or an existing one is reused.

These changes enhance flexibility in Azure deployments, allowing teams to integrate existing AI projects seamlessly while maintaining robust role assignment and telemetry support.

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


@description('Optional. Use this parameter to use an existing AI project resource ID')
param azureExistingAIProjectResourceId string?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

When we are reusing existing project we should not create cognitive service account as well. We should use the existing cognitive service resource itself.

@Shreyas-Microsoft Shreyas-Microsoft deleted the psl-use-existing-project branch July 17, 2025 14:27
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.

3 participants