Skip to content

Commit 0a360a5

Browse files
Merge pull request #373 from microsoft/hb-psl-us-37902
refactor: Refactor AI Services module to handle private networking via standalone aiFoundryPrivateEndpoint module
2 parents 0593023 + 73e2337 commit 0a360a5

3 files changed

Lines changed: 2983 additions & 140 deletions

File tree

infra/main.bicep

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -742,15 +742,7 @@ module aiServices 'modules/ai-foundry/aifoundry.bicep' = {
742742
projectName: 'proj-${solutionSuffix}'
743743
projectDescription: 'proj-${solutionSuffix}'
744744
logAnalyticsWorkspaceResourceId: enableMonitoring ? logAnalyticsWorkspaceResourceId : ''
745-
privateNetworking: enablePrivateNetworking
746-
? {
747-
virtualNetworkResourceId: virtualNetwork!.outputs.resourceId
748-
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
749-
cogServicesPrivateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
750-
openAIPrivateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.openAI]!.outputs.resourceId
751-
aiServicesPrivateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.aiServices]!.outputs.resourceId
752-
}
753-
: null
745+
privateNetworking: null // Private endpoint is handled by the standalone aiFoundryPrivateEndpoint module
754746
existingFoundryProjectResourceId: azureExistingAIProjectResourceId
755747
disableLocalAuth: true //Should be set to true for WAF aligned configuration
756748
customSubDomainName: 'aif-${solutionSuffix}'
@@ -789,6 +781,45 @@ module aiServices 'modules/ai-foundry/aifoundry.bicep' = {
789781
}
790782
}
791783

784+
var aiFoundryAiServicesResourceName = 'aif-${solutionSuffix}'
785+
var useExistingAiFoundryAiProject = !empty(azureExistingAIProjectResourceId)
786+
787+
module aiFoundryPrivateEndpoint 'br/public:avm/res/network/private-endpoint:0.8.1' = if (enablePrivateNetworking && !useExistingAiFoundryAiProject) {
788+
name: take('pep-${aiFoundryAiServicesResourceName}-deployment', 64)
789+
params: {
790+
name: 'pep-${aiFoundryAiServicesResourceName}'
791+
customNetworkInterfaceName: 'nic-${aiFoundryAiServicesResourceName}'
792+
location: location
793+
tags: allTags
794+
privateLinkServiceConnections: [
795+
{
796+
name: 'pep-${aiFoundryAiServicesResourceName}-connection'
797+
properties: {
798+
privateLinkServiceId: aiServices.outputs.resourceId
799+
groupIds: ['account']
800+
}
801+
}
802+
]
803+
privateDnsZoneGroup: {
804+
privateDnsZoneGroupConfigs: [
805+
{
806+
name: 'ai-services-dns-zone-cognitiveservices'
807+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
808+
}
809+
{
810+
name: 'ai-services-dns-zone-openai'
811+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.openAI]!.outputs.resourceId
812+
}
813+
{
814+
name: 'ai-services-dns-zone-aiservices'
815+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.aiServices]!.outputs.resourceId
816+
}
817+
]
818+
}
819+
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
820+
}
821+
}
822+
792823
var appStorageContainerName = 'appstorage'
793824

794825
module storageAccount 'modules/storageAccount.bicep' = {

0 commit comments

Comments
 (0)