Skip to content

Commit 1493763

Browse files
added dns for existing project to access
1 parent 9651a5a commit 1493763

File tree

1 file changed

+43
-4
lines changed

1 file changed

+43
-4
lines changed

infra/main.bicep

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -986,10 +986,7 @@ var aiRelatedDnsZoneIndices = [
986986
// ===================================================
987987
@batchSize(5)
988988
module avmPrivateDnsZones 'br/public:avm/res/network/private-dns-zone:0.7.1' = [
989-
for (zone, i) in privateDnsZones: if (enablePrivateNetworking && (!useExistingAiFoundryAiProject || !contains(
990-
aiRelatedDnsZoneIndices,
991-
i
992-
))) {
989+
for (zone, i) in privateDnsZones: if (enablePrivateNetworking) {
993990
name: 'avm.res.network.private-dns-zone.${contains(zone, 'azurecontainerapps.io') ? 'containerappenv' : split(zone, '.')[1]}'
994991
params: {
995992
name: zone
@@ -1078,6 +1075,48 @@ module existingAiFoundryAiServicesDeployments 'modules/ai-services-deployments.b
10781075
}
10791076
}
10801077

1078+
// ========== Private Endpoint for Existing AI Services ========== //
1079+
var shouldCreatePrivateEndpoint = useExistingAiFoundryAiProject && enablePrivateNetworking
1080+
module existingAiServicesPrivateEndpoint 'br/public:avm/res/network/private-endpoint:0.11.0' = if (shouldCreatePrivateEndpoint) {
1081+
name: take('module.private-endpoint.${existingAiFoundryAiServices.name}', 64)
1082+
params: {
1083+
name: 'pep-${existingAiFoundryAiServices.name}'
1084+
location: location
1085+
subnetResourceId: virtualNetwork!.outputs.subnetResourceIds[0]
1086+
customNetworkInterfaceName: 'nic-${existingAiFoundryAiServices.name}'
1087+
privateDnsZoneGroup: {
1088+
privateDnsZoneGroupConfigs: [
1089+
{
1090+
name: 'ai-services-dns-zone-cognitiveservices'
1091+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
1092+
}
1093+
{
1094+
name: 'ai-services-dns-zone-openai'
1095+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.openAI]!.outputs.resourceId
1096+
}
1097+
{
1098+
name: 'ai-services-dns-zone-aiservices'
1099+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.aiServices]!.outputs.resourceId
1100+
}
1101+
]
1102+
}
1103+
privateLinkServiceConnections: [
1104+
{
1105+
name: 'pep-${existingAiFoundryAiServices.name}'
1106+
properties: {
1107+
groupIds: ['account']
1108+
privateLinkServiceId: existingAiFoundryAiServices.id
1109+
}
1110+
}
1111+
]
1112+
tags: tags
1113+
}
1114+
dependsOn: [
1115+
existingAiFoundryAiServices
1116+
avmPrivateDnsZones
1117+
]
1118+
}
1119+
10811120
module aiFoundryAiServices 'br:mcr.microsoft.com/bicep/avm/res/cognitive-services/account:0.13.2' = if (!useExistingAiFoundryAiProject) {
10821121
name: take('avm.res.cognitive-services.account.${aiFoundryAiServicesResourceName}', 64)
10831122
params: {

0 commit comments

Comments
 (0)