Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -651,11 +651,11 @@ var dnsZoneIndex = {
}

// List of DNS zone indices that correspond to AI-related services.
var aiRelatedDnsZoneIndices = [
dnsZoneIndex.cognitiveServices
dnsZoneIndex.openAI
dnsZoneIndex.aiServices
]
// var aiRelatedDnsZoneIndices = [
// dnsZoneIndex.cognitiveServices
// dnsZoneIndex.openAI
// dnsZoneIndex.aiServices
// ]

// ===================================================
// DEPLOY PRIVATE DNS ZONES
Expand All @@ -664,10 +664,7 @@ var aiRelatedDnsZoneIndices = [
// ===================================================
@batchSize(5)
module avmPrivateDnsZones 'br/public:avm/res/network/private-dns-zone:0.7.1' = [
for (zone, i) in privateDnsZones: if (enablePrivateNetworking && (!useExistingAiFoundryAiProject || !contains(
aiRelatedDnsZoneIndices,
i
))) {
for (zone, i) in privateDnsZones: if (enablePrivateNetworking) {
name: 'avm.res.network.private-dns-zone.${contains(zone, 'azurecontainerapps.io') ? 'containerappenv' : split(zone, '.')[1]}'
params: {
name: zone
Expand Down Expand Up @@ -756,6 +753,27 @@ module existingAiFoundryAiServicesDeployments 'modules/ai-services-deployments.b
}
}

// ========== Private Endpoint for Existing AI Services ========== //
var shouldCreatePrivateEndpoint = useExistingAiFoundryAiProject && enablePrivateNetworking
var isProjectPrivate = existingAiFoundryAiServices!.properties.publicNetworkAccess == 'Enabled' ? false : true
module existingAiServicesPrivateEndpoint './modules/existing-aif-private-endpoint.bicep' = if (shouldCreatePrivateEndpoint){
name: take('module.proj-private-endpoint.${existingAiFoundryAiServices.name}', 64)
params: {
isPrivate: isProjectPrivate
aiServicesName: existingAiFoundryAiServices.name
subnetResourceId: virtualNetwork!.outputs.backendSubnetResourceId
aiServicesId: existingAiFoundryAiServices.id
location: location
cognitiveServicesDnsZoneId: avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
openAiDnsZoneId: avmPrivateDnsZones[dnsZoneIndex.openAI]!.outputs.resourceId
aiServicesDnsZoneId: avmPrivateDnsZones[dnsZoneIndex.aiServices]!.outputs.resourceId
tags: tags
}
dependsOn: [
avmPrivateDnsZones
]
}

module aiFoundryAiServices 'br:mcr.microsoft.com/bicep/avm/res/cognitive-services/account:0.13.2' = if (!useExistingAiFoundryAiProject) {
name: take('avm.res.cognitive-services.account.${aiFoundryAiServicesResourceName}', 64)
params: {
Expand Down
Loading
Loading