@@ -107,10 +107,10 @@ param frontendContainerImageTag string = 'latest_2025-07-22_895'
107107@description ('Optional. Enable/Disable usage telemetry for module.' )
108108param enableTelemetry bool = true
109109
110- @description ('Use this parameter to reuse an existing Log Analytics Workspace' )
110+ @description ('Optional. Resource ID of an existing Log Analytics Workspace' )
111111param existingLogAnalyticsWorkspaceId string = ''
112-
113- @description ('Use this parameter to reuse an existing AI project resource ID ' )
112+
113+ @description ('Optional. Resource ID of an existing Foundry project' )
114114param existingFoundryProjectResourceId string = ''
115115
116116// ============== //
@@ -979,6 +979,7 @@ module aiFoundryAiServices 'modules/ai-services.bicep' = if (aiFoundryAIservices
979979 name : aiFoundryAiServicesResourceName
980980 location : azureAiServiceLocation
981981 tags : tags
982+ existingFoundryProjectResourceId : existingFoundryProjectResourceId
982983 projectName : aiFoundryAiServicesAiProjectResourceName
983984 projectDescription : 'AI Foundry Project'
984985 sku : 'S0'
@@ -1014,7 +1015,7 @@ module aiFoundryAiServices 'modules/ai-services.bicep' = if (aiFoundryAIservices
10141015 // WAF aligned configuration for Monitoring
10151016 diagnosticSettings : enableMonitoring ? [{ workspaceResourceId : logAnalyticsWorkspaceResourceId }] : null
10161017 publicNetworkAccess : enablePrivateNetworking ? 'Disabled' : 'Enabled'
1017- privateEndpoints : enablePrivateNetworking
1018+ privateEndpoints : ( enablePrivateNetworking && empty ( existingFoundryProjectResourceId ))
10181019 ? ([
10191020 {
10201021 name : 'pep-${aiFoundryAiServicesResourceName }'
@@ -1057,43 +1058,6 @@ module aiFoundryAiServices 'modules/ai-services.bicep' = if (aiFoundryAIservices
10571058 }
10581059}
10591060
1060- //Role assignments for AI Project
1061- module resourceRoleAssignmentAiServicesAiProjectAiUser 'br/public:avm/ptn/authorization/resource-role-assignment:0.1.2' = {
1062- name : 'avm.ptn.authorization.resource-role-assignment.${uniqueString (aiFoundryAiServicesAiProjectResourceName ,containerAppResourceName ,'Azure AI User' )}'
1063- params : {
1064- roleName : 'Azure AI User'
1065- roleDefinitionId : '53ca6127-db72-4b80-b1b0-d745d6d5456d'
1066- principalId : userAssignedIdentity .outputs .principalId
1067- principalType : 'ServicePrincipal'
1068- resourceId : aiFoundryAiServices .outputs .aiProjectResourceId
1069- enableTelemetry : enableTelemetry
1070- }
1071- }
1072-
1073- module resourceRoleAssignmentAiServicesAiProjectAiDeveloper 'br/public:avm/ptn/authorization/resource-role-assignment:0.1.2' = {
1074- name : 'avm.ptn.authorization.resource-role-assignment.${uniqueString (aiFoundryAiServicesAiProjectResourceName ,containerAppResourceName ,'Azure AI Developer' )}'
1075- params : {
1076- roleName : 'Azure AI Developer'
1077- roleDefinitionId : '64702f94-c441-49e6-a78b-ef80e0188fee'
1078- principalId : userAssignedIdentity .outputs .principalId
1079- principalType : 'ServicePrincipal'
1080- resourceId : aiFoundryAiServices .outputs .aiProjectResourceId
1081- enableTelemetry : enableTelemetry
1082- }
1083- }
1084-
1085- module resourceRoleAssignmentAiServicesAiProjectCognitiveServicesOpenAiUser 'br/public:avm/ptn/authorization/resource-role-assignment:0.1.2' = {
1086- name : 'avm.ptn.authorization.resource-role-assignment.${uniqueString (aiFoundryAiServicesAiProjectResourceName ,containerAppResourceName ,'Cognitive Services OpenAI User' )}'
1087- params : {
1088- roleName : 'Cognitive Services OpenAI User'
1089- roleDefinitionId : '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd'
1090- principalId : userAssignedIdentity .outputs .principalId
1091- principalType : 'ServicePrincipal'
1092- resourceId : aiFoundryAiServices .outputs .aiProjectResourceId
1093- enableTelemetry : enableTelemetry
1094- }
1095- }
1096-
10971061// ========== Cosmos DB ========== //
10981062// WAF best practices for Cosmos DB: https://learn.microsoft.com/en-us/azure/well-architected/service-guides/cosmos-db
10991063
@@ -1342,7 +1306,7 @@ module containerApp 'br/public:avm/res/app/container-app:0.18.1' = {
13421306 }
13431307 {
13441308 name : 'AZURE_OPENAI_ENDPOINT'
1345- value : 'https://${ aiFoundryAiServicesResourceName }.openai.azure.com/'
1309+ value : aiFoundryAiServices . outputs . endpoint
13461310 }
13471311 {
13481312 name : 'AZURE_OPENAI_MODEL_NAME'
@@ -1382,7 +1346,7 @@ module containerApp 'br/public:avm/res/app/container-app:0.18.1' = {
13821346 }
13831347 {
13841348 name : 'AZURE_AI_AGENT_ENDPOINT'
1385- value : aiFoundryAiServices .outputs .aiProjectApiEndpoint
1349+ value : aiFoundryAiServices .outputs .aiProjectInfo . apiEndpoint
13861350 }
13871351 {
13881352 name : 'AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME'
0 commit comments