Skip to content

Commit 2d60268

Browse files
fix: Added network policy for foundry project
1 parent 052ac1b commit 2d60268

3 files changed

Lines changed: 22 additions & 23 deletions

File tree

infra/main.bicep

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,7 @@ module avmAiServices 'modules/account/main.bicep' = {
590590
]
591591
networkAcls: {
592592
bypass: 'AzureServices'
593-
//defaultAction: (enablePrivateNetworking) ? 'Deny' : 'Allow'
594-
defaultAction: 'Allow' // Always allow for AI Services
593+
defaultAction: (enablePrivateNetworking) ? 'Deny' : 'Allow'
595594
}
596595
disableLocalAuth: true
597596
enableTelemetry: enableTelemetry

infra/main.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"_generator": {
77
"name": "bicep",
88
"version": "0.36.1.42791",
9-
"templateHash": "5051872456300539828"
9+
"templateHash": "12587990285876720392"
1010
},
1111
"name": "Content Processing Solution Accelerator",
1212
"description": "Bicep template to deploy the Content Processing Solution Accelerator with AVM compliance."
@@ -24856,7 +24856,7 @@
2485624856
"networkAcls": {
2485724857
"value": {
2485824858
"bypass": "AzureServices",
24859-
"defaultAction": "Allow"
24859+
"defaultAction": "[if(parameters('enablePrivateNetworking'), 'Deny', 'Allow')]"
2486024860
}
2486124861
},
2486224862
"disableLocalAuth": {
@@ -24893,7 +24893,7 @@
2489324893
"_generator": {
2489424894
"name": "bicep",
2489524895
"version": "0.36.1.42791",
24896-
"templateHash": "3041578275611732364"
24896+
"templateHash": "16330577693396165210"
2489724897
},
2489824898
"name": "Cognitive Services",
2489924899
"description": "This module deploys a Cognitive Service."
@@ -26087,11 +26087,11 @@
2608726087
"resourceGroup": "[variables('existingCognitiveServiceDetails')[4]]",
2608826088
"name": "[variables('existingCognitiveServiceDetails')[8]]"
2608926089
},
26090-
"cognigive_service_dependencies": {
26090+
"cognitive_service_dependencies": {
2609126091
"condition": "[not(variables('useExistingService'))]",
2609226092
"type": "Microsoft.Resources/deployments",
2609326093
"apiVersion": "2022-09-01",
26094-
"name": "[format('cognigive_service_dependencies-{0}', uniqueString('cognigive_service_dependencies', deployment().name))]",
26094+
"name": "[format('cognitive_service_dependencies-{0}', uniqueString('cognitive_service_dependencies', deployment().name))]",
2609526095
"properties": {
2609626096
"expressionEvaluationOptions": {
2609726097
"scope": "inner"
@@ -26143,7 +26143,7 @@
2614326143
"_generator": {
2614426144
"name": "bicep",
2614526145
"version": "0.36.1.42791",
26146-
"templateHash": "13861656449810456066"
26146+
"templateHash": "4128376395637895528"
2614726147
}
2614826148
},
2614926149
"definitions": {
@@ -28106,7 +28106,7 @@
2810628106
"_generator": {
2810728107
"name": "bicep",
2810828108
"version": "0.36.1.42791",
28109-
"templateHash": "6625892890991710866"
28109+
"templateHash": "125568697111155565"
2811028110
}
2811128111
},
2811228112
"definitions": {
@@ -28183,7 +28183,7 @@
2818328183
"variables": {
2818428184
"useExistingProject": "[not(empty(parameters('azureExistingAIProjectResourceId')))]",
2818528185
"existingProjName": "[if(variables('useExistingProject'), last(split(parameters('azureExistingAIProjectResourceId'), '/')), '')]",
28186-
"existingProjEndpoint": "[if(variables('useExistingProject'), format('https://{0}.services.ai.azure.com/api/projects/{0}', variables('existingProjName')), '')]"
28186+
"existingProjEndpoint": "[if(variables('useExistingProject'), format('https://{0}.services.ai.azure.com/api/projects/{1}', parameters('aiServicesName'), variables('existingProjName')), '')]"
2818728187
},
2818828188
"resources": {
2818928189
"cogServiceReference": {
@@ -28263,11 +28263,11 @@
2826328263
"cognitiveServiceNew"
2826428264
]
2826528265
},
28266-
"existing_cognigive_service_dependencies": {
28266+
"existing_cognitive_service_dependencies": {
2826728267
"condition": "[variables('useExistingService')]",
2826828268
"type": "Microsoft.Resources/deployments",
2826928269
"apiVersion": "2022-09-01",
28270-
"name": "[format('existing_cognigive_service_dependencies-{0}', uniqueString('existing_cognigive_service_dependencies', deployment().name))]",
28270+
"name": "[format('existing_cognitive_service_dependencies-{0}', uniqueString('existing_cognitive_service_dependencies', deployment().name))]",
2827128271
"subscriptionId": "[variables('existingCognitiveServiceDetails')[2]]",
2827228272
"resourceGroup": "[variables('existingCognitiveServiceDetails')[4]]",
2827328273
"properties": {
@@ -28324,7 +28324,7 @@
2832428324
"_generator": {
2832528325
"name": "bicep",
2832628326
"version": "0.36.1.42791",
28327-
"templateHash": "13861656449810456066"
28327+
"templateHash": "4128376395637895528"
2832828328
}
2832928329
},
2833028330
"definitions": {
@@ -30287,7 +30287,7 @@
3028730287
"_generator": {
3028830288
"name": "bicep",
3028930289
"version": "0.36.1.42791",
30290-
"templateHash": "6625892890991710866"
30290+
"templateHash": "125568697111155565"
3029130291
}
3029230292
},
3029330293
"definitions": {
@@ -30364,7 +30364,7 @@
3036430364
"variables": {
3036530365
"useExistingProject": "[not(empty(parameters('azureExistingAIProjectResourceId')))]",
3036630366
"existingProjName": "[if(variables('useExistingProject'), last(split(parameters('azureExistingAIProjectResourceId'), '/')), '')]",
30367-
"existingProjEndpoint": "[if(variables('useExistingProject'), format('https://{0}.services.ai.azure.com/api/projects/{0}', variables('existingProjName')), '')]"
30367+
"existingProjEndpoint": "[if(variables('useExistingProject'), format('https://{0}.services.ai.azure.com/api/projects/{1}', parameters('aiServicesName'), variables('existingProjName')), '')]"
3036830368
},
3036930369
"resources": {
3037030370
"cogServiceReference": {
@@ -30491,21 +30491,21 @@
3049130491
"metadata": {
3049230492
"description": "The principal ID of the system assigned identity."
3049330493
},
30494-
"value": ""
30494+
"value": "[if(variables('useExistingService'), reference('cognitiveServiceExisting', '2025-04-01-preview', 'full').identity.principalId, tryGet(tryGet(if(variables('useExistingService'), reference('cognitiveServiceExisting', '2025-04-01-preview', 'full'), reference('cognitiveServiceNew', '2025-04-01-preview', 'full')), 'identity'), 'principalId'))]"
3049530495
},
3049630496
"location": {
3049730497
"type": "string",
3049830498
"metadata": {
3049930499
"description": "The location the resource was deployed into."
3050030500
},
30501-
"value": ""
30501+
"value": "[if(variables('useExistingService'), reference('cognitiveServiceExisting', '2025-04-01-preview', 'full').location, if(variables('useExistingService'), reference('cognitiveServiceExisting', '2025-04-01-preview', 'full'), reference('cognitiveServiceNew', '2025-04-01-preview', 'full')).location)]"
3050230502
},
3050330503
"exportedSecrets": {
3050430504
"$ref": "#/definitions/secretsOutputType",
3050530505
"metadata": {
3050630506
"description": "A hashtable of references to the secrets exported to the provided Key Vault. The key of each reference is each secret's name."
3050730507
},
30508-
"value": {}
30508+
"value": "[if(variables('useExistingService'), reference('existing_cognitive_service_dependencies').outputs.exportedSecrets.value, reference('cognitive_service_dependencies').outputs.exportedSecrets.value)]"
3050930509
},
3051030510
"privateEndpoints": {
3051130511
"type": "array",
@@ -30515,11 +30515,11 @@
3051530515
"metadata": {
3051630516
"description": "The private endpoints of the congitive services account."
3051730517
},
30518-
"value": []
30518+
"value": "[if(variables('useExistingService'), reference('existing_cognitive_service_dependencies').outputs.privateEndpoints.value, reference('cognitive_service_dependencies').outputs.privateEndpoints.value)]"
3051930519
},
3052030520
"aiProjectInfo": {
3052130521
"$ref": "#/definitions/aiProjectOutputType",
30522-
"value": "[if(variables('useExistingService'), reference('existing_cognigive_service_dependencies').outputs.aiProjectInfo.value, reference('cognigive_service_dependencies').outputs.aiProjectInfo.value)]"
30522+
"value": "[if(variables('useExistingService'), reference('existing_cognitive_service_dependencies').outputs.aiProjectInfo.value, reference('cognitive_service_dependencies').outputs.aiProjectInfo.value)]"
3052330523
}
3052430524
}
3052530525
}
@@ -30528,9 +30528,9 @@
3052830528
"avmContainerApp",
3052930529
"avmManagedIdentity",
3053030530
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').aiServices)]",
30531+
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').contentUnderstanding)]",
3053130532
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').openAI)]",
3053230533
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]",
30533-
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').contentUnderstanding)]",
3053430534
"avmVirtualNetwork",
3053530535
"logAnalyticsWorkspace"
3053630536
]
@@ -32868,8 +32868,8 @@
3286832868
"dependsOn": [
3286932869
"avmContainerApp",
3287032870
"avmManagedIdentity",
32871-
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').contentUnderstanding)]",
3287232871
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]",
32872+
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').contentUnderstanding)]",
3287332873
"avmVirtualNetwork"
3287432874
]
3287532875
},

infra/modules/account/main.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ output exportedSecrets secretsOutputType = useExistingService ? existing_cogniti
323323
@description('The private endpoints of the congitive services account.')
324324
output privateEndpoints privateEndpointOutputType[] = useExistingService ? existing_cognitive_service_dependencies.outputs.privateEndpoints : cognitive_service_dependencies.outputs.privateEndpoints
325325

326-
import { aiProjectOutputType } from './project.bicep'
326+
import { aiProjectOutputType } from './modules/project.bicep'
327327
output aiProjectInfo aiProjectOutputType = useExistingService ? existing_cognitive_service_dependencies.outputs.aiProjectInfo : cognitive_service_dependencies.outputs.aiProjectInfo
328328

329329
// ================ //

0 commit comments

Comments
 (0)