@@ -674,6 +674,60 @@ module avmAiServices 'modules/account/main.bicep' = {
674674 }
675675}
676676
677+ // ========== Private Endpoint for Existing AI Services ========== //
678+ var useExistingService = !empty (existingProjectResourceId )
679+ var existingCognitiveServiceDetails = split (existingProjectResourceId , '/' )
680+
681+ resource existingAiFoundryAiServices 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' existing = if (useExistingService ) {
682+ name : existingCognitiveServiceDetails [8 ]
683+ scope : resourceGroup (existingCognitiveServiceDetails [2 ], existingCognitiveServiceDetails [4 ])
684+ }
685+
686+ var shouldCreatePrivateEndpoint = useExistingService && enablePrivateNetworking
687+ module existingAiServicesPrivateEndpoint 'br/public:avm/res/network/private-endpoint:0.11.0' = if (shouldCreatePrivateEndpoint ) {
688+ name : take ('module.private-endpoint.${existingAiFoundryAiServices .name }' , 64 )
689+ params : {
690+ name : 'pep-${existingAiFoundryAiServices .name }'
691+ subnetResourceId : avmVirtualNetwork !.outputs .subnetResourceIds [0 ]
692+ customNetworkInterfaceName : 'nic-${existingAiFoundryAiServices .name }'
693+ privateDnsZoneGroup : {
694+ privateDnsZoneGroupConfigs : [
695+ {
696+ name : 'ai-services-dns-zone-cognitiveservices'
697+ privateDnsZoneResourceId : avmPrivateDnsZones [dnsZoneIndex .cognitiveServices ].outputs .resourceId
698+ }
699+ {
700+ name : 'ai-services-dns-zone-openai'
701+ privateDnsZoneResourceId : avmPrivateDnsZones [dnsZoneIndex .openAI ].outputs .resourceId
702+ }
703+ {
704+ name : 'ai-services-dns-zone-aiservices'
705+ privateDnsZoneResourceId : avmPrivateDnsZones [dnsZoneIndex .aiServices ].outputs .resourceId
706+ }
707+ {
708+ name : 'ai-services-dns-zone-contentunderstanding'
709+ privateDnsZoneResourceId : avmPrivateDnsZones [dnsZoneIndex .contentUnderstanding ].outputs .resourceId
710+ }
711+ ]
712+ }
713+ privateLinkServiceConnections : [
714+ {
715+ name : 'pep-${existingAiFoundryAiServices .name }'
716+ properties : {
717+ groupIds : ['account' ]
718+ privateLinkServiceId : existingAiFoundryAiServices .id
719+ }
720+ }
721+ ]
722+ tags : tags
723+ }
724+ dependsOn : [
725+ existingAiFoundryAiServices
726+ avmPrivateDnsZones
727+ avmVirtualNetwork
728+ ]
729+ }
730+
677731module avmAiServices_cu 'br/public:avm/res/cognitive-services/account:0.11.0' = {
678732 name : format (resourceNameFormatString , 'aicu-' )
679733
0 commit comments