Skip to content

Commit 1090275

Browse files
Merge pull request #575 from microsoft/hb-psl-us-37902
refactor: refactor private endpoint configuration to deploy separately via openaiPrivateEndpoint and docIntelPrivateEndpoint module
2 parents 782e2d0 + 4914f94 commit 1090275

2 files changed

Lines changed: 2139 additions & 574 deletions

File tree

infra/main.bicep

Lines changed: 63 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -827,23 +827,7 @@ module avmOpenAi 'br/public:avm/res/cognitive-services/account:0.13.2' = {
827827
bypass: 'AzureServices'
828828
}
829829

830-
privateEndpoints: enablePrivateNetworking
831-
? [
832-
{
833-
name: 'pep-openai-${solutionSuffix}'
834-
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
835-
service: 'account'
836-
privateDnsZoneGroup: {
837-
privateDnsZoneGroupConfigs: [
838-
{
839-
name: 'openai-dns-zone-group'
840-
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.openAI]!.outputs.resourceId
841-
}
842-
]
843-
}
844-
}
845-
]
846-
: []
830+
privateEndpoints: []
847831

848832
// Role assignments
849833
roleAssignments: [
@@ -864,6 +848,38 @@ module avmOpenAi 'br/public:avm/res/cognitive-services/account:0.13.2' = {
864848
}
865849
}
866850

851+
module openaiPrivateEndpoint 'br/public:avm/res/network/private-endpoint:0.8.1' = if (enablePrivateNetworking) {
852+
name: take('pep-${openAiAccountName}-deployment', 64)
853+
params: {
854+
name: 'pep-${openAiAccountName}'
855+
customNetworkInterfaceName: 'nic-${openAiAccountName}'
856+
location: solutionLocation
857+
tags: tags
858+
privateLinkServiceConnections: [
859+
{
860+
name: 'pep-${openAiAccountName}-connection'
861+
properties: {
862+
privateLinkServiceId: avmOpenAi.outputs.resourceId
863+
groupIds: ['account']
864+
}
865+
}
866+
]
867+
privateDnsZoneGroup: {
868+
privateDnsZoneGroupConfigs: [
869+
{
870+
name: 'ai-services-dns-zone-cognitiveservices'
871+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
872+
}
873+
{
874+
name: 'ai-services-dns-zone-openai'
875+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.openAI]!.outputs.resourceId
876+
}
877+
]
878+
}
879+
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
880+
}
881+
}
882+
867883
// ========== Cognitive Services - Document Intellignece module ========== //
868884
var docIntelAccountName = 'di-${solutionSuffix}'
869885
module documentIntelligence 'br/public:avm/res/cognitive-services/account:0.13.2' = {
@@ -886,24 +902,8 @@ module documentIntelligence 'br/public:avm/res/cognitive-services/account:0.13.2
886902
defaultAction: enablePrivateNetworking ? 'Deny' : 'Allow'
887903
}
888904

889-
// Private Endpoint for Form Recognizer
890-
privateEndpoints: enablePrivateNetworking
891-
? [
892-
{
893-
name: 'pep-docintel-${solutionSuffix}'
894-
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
895-
service: 'account'
896-
privateDnsZoneGroup: {
897-
privateDnsZoneGroupConfigs: [
898-
{
899-
name: 'docintel-dns-zone-group'
900-
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
901-
}
902-
]
903-
}
904-
}
905-
]
906-
: []
905+
// Private Endpoint separated to dedicated module below
906+
privateEndpoints: []
907907

908908
// Role Assignments
909909
roleAssignments: [
@@ -916,6 +916,34 @@ module documentIntelligence 'br/public:avm/res/cognitive-services/account:0.13.2
916916
}
917917
}
918918

919+
module docIntelPrivateEndpoint 'br/public:avm/res/network/private-endpoint:0.8.1' = if (enablePrivateNetworking) {
920+
name: take('pep-${docIntelAccountName}-deployment', 64)
921+
params: {
922+
name: 'pep-${docIntelAccountName}'
923+
customNetworkInterfaceName: 'nic-${docIntelAccountName}'
924+
location: solutionLocation
925+
tags: tags
926+
privateLinkServiceConnections: [
927+
{
928+
name: 'pep-${docIntelAccountName}-connection'
929+
properties: {
930+
privateLinkServiceId: documentIntelligence.outputs.resourceId
931+
groupIds: ['account']
932+
}
933+
}
934+
]
935+
privateDnsZoneGroup: {
936+
privateDnsZoneGroupConfigs: [
937+
{
938+
name: 'docintel-dns-zone-cognitiveservices'
939+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
940+
}
941+
]
942+
}
943+
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
944+
}
945+
}
946+
919947
// ========== Azure Kubernetes Service (AKS) ========== //
920948
module managedCluster 'br/public:avm/res/container-service/managed-cluster:0.10.1' = {
921949
name: take('avm.res.container-service.managed-cluster.aks-${solutionSuffix}', 64)

0 commit comments

Comments
 (0)