@@ -20,6 +20,15 @@ param tags object = {}
2020@description ('Optional. Enable/Disable usage telemetry for module.' )
2121param enableTelemetry bool = true
2222
23+ @description ('Optional. Use this parameter to use an existing AI project resource ID' )
24+ param azureExistingAIProjectResourceId string ?
25+
26+ // Endpoint from existing AI Project Resource ID if provided
27+ var existingProjEndpoint = !empty (azureExistingAIProjectResourceId ) ?
28+ format ('https://{0}.services.ai.azure.com/api/projects/{1}' ,
29+ split (azureExistingAIProjectResourceId , '/' )[8 ], split (azureExistingAIProjectResourceId , '/' )
30+ [10 ]) : ''
31+
2332// using a few built-in roles here that makes sense for Foundry projects only
2433var builtInRoleNames = {
2534 'Cognitive Services OpenAI Contributor' : subscriptionResourceId (
@@ -55,7 +64,7 @@ resource cogServiceReference 'Microsoft.CognitiveServices/accounts@2024-10-01' e
5564 name : aiServicesName
5665}
5766
58- resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' = {
67+ resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' = if ( empty ( azureExistingAIProjectResourceId )) {
5968 parent : cogServiceReference
6069 name : name
6170 tags : tags
@@ -89,7 +98,7 @@ output name string = aiProject.name
8998output resourceId string = aiProject .id
9099
91100@description ('API endpoint for the AI Foundry project.' )
92- output apiEndpoint string = aiProject .properties .endpoints ['AI Foundry API' ]
101+ output apiEndpoint string = ! empty ( existingProjEndpoint ) ? existingProjEndpoint : aiProject .properties .endpoints ['AI Foundry API' ]
93102
94103@export ()
95104@description ('Output type representing AI project information.' )
0 commit comments