Skip to content

Commit 3bc99fc

Browse files
Merge pull request #570 from microsoft/PSL-US-24017
fix: added dns for existing project to access
2 parents 1967e41 + e6e5d43 commit 3bc99fc

File tree

3 files changed

+12855
-15359
lines changed

3 files changed

+12855
-15359
lines changed

infra/main.bicep

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ param enableRedundancy bool = false
124124
param enablePrivateNetworking bool = false
125125

126126
@description('Optional. The Container Registry hostname where the docker images are located.')
127-
param acrName string = 'byocgacontainerreg' // testapwaf
127+
param acrName string = 'byocgacontainerreg'
128128

129129
@description('Optional. Image Tag.')
130130
param imageTag string = 'latest_waf_2025-09-18_736'
@@ -568,6 +568,48 @@ module existingAiFoundryAiServicesDeployments 'modules/ai-services-deployments.b
568568
}
569569
}
570570

571+
// ========== Private Endpoint for Existing AI Services ========== //
572+
var shouldCreatePrivateEndpoint = useExistingAiFoundryAiProject && enablePrivateNetworking
573+
module existingAiServicesPrivateEndpoint 'br/public:avm/res/network/private-endpoint:0.11.0' = if (shouldCreatePrivateEndpoint) {
574+
name: take('module.private-endpoint.${existingAiFoundryAiServices.name}', 64)
575+
params: {
576+
name: 'pep-${existingAiFoundryAiServices.name}'
577+
location: location
578+
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
579+
customNetworkInterfaceName: 'nic-${existingAiFoundryAiServices.name}'
580+
privateDnsZoneGroup: {
581+
privateDnsZoneGroupConfigs: [
582+
{
583+
name: 'ai-services-dns-zone-cognitiveservices'
584+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
585+
}
586+
{
587+
name: 'ai-services-dns-zone-openai'
588+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.openAI]!.outputs.resourceId
589+
}
590+
{
591+
name: 'ai-services-dns-zone-aiservices'
592+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.aiServices]!.outputs.resourceId
593+
}
594+
]
595+
}
596+
privateLinkServiceConnections: [
597+
{
598+
name: 'pep-${existingAiFoundryAiServices.name}'
599+
properties: {
600+
groupIds: ['account']
601+
privateLinkServiceId: existingAiFoundryAiServices.id
602+
}
603+
}
604+
]
605+
tags: tags
606+
}
607+
dependsOn: [
608+
existingAiFoundryAiServices
609+
avmPrivateDnsZones
610+
]
611+
}
612+
571613
module aiFoundryAiServices 'br:mcr.microsoft.com/bicep/avm/res/cognitive-services/account:0.13.2' = if (!useExistingAiFoundryAiProject) {
572614
name: take('avm.res.cognitive-services.account.${aiFoundryAiServicesResourceName}', 64)
573615
params: {
@@ -673,7 +715,7 @@ module aiFoundryAiServicesProject 'modules/ai-project.bicep' = if (!useExistingA
673715
}
674716

675717
var aiFoundryAiProjectEndpoint = useExistingAiFoundryAiProject
676-
? existingAiFoundryAiServicesProject!.properties.endpoints['AI Foundry API']
718+
? 'https://${aiFoundryAiServicesResourceName}.services.ai.azure.com/api/projects/${aiFoundryAiProjectResourceName}'
677719
: aiFoundryAiServicesProject!.outputs.apiEndpoint
678720

679721
// ========== Search Service to AI Services Role Assignment ========== //

0 commit comments

Comments
 (0)