@@ -535,7 +535,7 @@ var aiRelatedDnsZoneIndices = [
535535// ===================================================
536536@batchSize (5 )
537537module avmPrivateDnsZones 'br/public:avm/res/network/private-dns-zone:0.7.1' = [
538- for (zone , i ) in privateDnsZones : if (enablePrivateNetworking && ( empty ( existingFoundryProjectResourceId ) || ! contains ( aiRelatedDnsZoneIndices , i )) ) {
538+ for (zone , i ) in privateDnsZones : if (enablePrivateNetworking ) {
539539 name : 'avm.res.network.private-dns-zone.${split (zone , '.' )[1 ]}'
540540 params : {
541541 name : zone
@@ -1165,6 +1165,47 @@ resource existingAiFoundryAiServicesProject 'Microsoft.CognitiveServices/account
11651165 parent : existingAiFoundryAiServices
11661166}
11671167
1168+ // ========== Private Endpoint for Existing AI Services ========== //
1169+ var shouldCreatePrivateEndpoint = useExistingAiFoundryAiProject && enablePrivateNetworking
1170+ module existingAiServicesPrivateEndpoint 'br/public:avm/res/network/private-endpoint:0.11.0' = if (shouldCreatePrivateEndpoint ) {
1171+ name : take ('module.private-endpoint.${existingAiFoundryAiServices .name }' , 64 )
1172+ params : {
1173+ name : 'pep-${existingAiFoundryAiServices .name }'
1174+ location : location
1175+ subnetResourceId : virtualNetwork !.outputs .pepsSubnetResourceId
1176+ customNetworkInterfaceName : 'nic-${existingAiFoundryAiServices .name }'
1177+ privateDnsZoneGroup : {
1178+ privateDnsZoneGroupConfigs : [
1179+ {
1180+ name : 'ai-services-dns-zone-cognitiveservices'
1181+ privateDnsZoneResourceId : avmPrivateDnsZones [dnsZoneIndex .cognitiveServices ]!.outputs .resourceId
1182+ }
1183+ {
1184+ name : 'ai-services-dns-zone-openai'
1185+ privateDnsZoneResourceId : avmPrivateDnsZones [dnsZoneIndex .openAI ]!.outputs .resourceId
1186+ }
1187+ {
1188+ name : 'ai-services-dns-zone-aiservices'
1189+ privateDnsZoneResourceId : avmPrivateDnsZones [dnsZoneIndex .aiServices ]!.outputs .resourceId
1190+ }
1191+ ]
1192+ }
1193+ privateLinkServiceConnections : [
1194+ {
1195+ name : 'pep-${existingAiFoundryAiServices .name }'
1196+ properties : {
1197+ groupIds : ['account' ]
1198+ privateLinkServiceId : existingAiFoundryAiServices .id
1199+ }
1200+ }
1201+ ]
1202+ tags : tags
1203+ }
1204+ dependsOn : [
1205+ existingAiFoundryAiServices
1206+ avmPrivateDnsZones
1207+ ]
1208+ }
11681209
11691210var aiSearchName = 'srch-${solutionSuffix }'
11701211module searchService 'br/public:avm/res/search/search-service:0.11.1' = {
0 commit comments