Skip to content

Commit 9a52728

Browse files
added dns for existing project to access
1 parent c6f19ab commit 9a52728

File tree

6 files changed

+1189
-428
lines changed

6 files changed

+1189
-428
lines changed

infra/main.bicep

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ var aiRelatedDnsZoneIndices = [
449449
// ===================================================
450450
@batchSize(5)
451451
module avmPrivateDnsZones 'br/public:avm/res/network/private-dns-zone:0.7.1' = [
452-
for (zone, i) in privateDnsZones: if (enablePrivateNetworking && (empty(existingFoundryProjectResourceId) || !contains(aiRelatedDnsZoneIndices, i))) {
452+
for (zone, i) in privateDnsZones: if (enablePrivateNetworking) {
453453
name: 'dns-zone-${i}'
454454
params: {
455455
name: zone
@@ -1070,6 +1070,47 @@ resource existingAiFoundryAiServicesProject 'Microsoft.CognitiveServices/account
10701070
parent: existingAiFoundryAiServices
10711071
}
10721072

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

10741115
var aiSearchName = 'srch-${solutionSuffix}'
10751116
module searchService 'br/public:avm/res/search/search-service:0.11.1' = {

0 commit comments

Comments
 (0)