@@ -205,6 +205,50 @@ resource cMKUserAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentiti
205205
206206var useExistingService = !empty (existingFoundryProjectResourceId )
207207
208+ module cognitiveServicesPrivateDnsZone '../privateDnsZone.bicep' = if (!useExistingService && privateNetworking != null && empty (privateNetworking .?cogServicesPrivateDnsZoneResourceId )) {
209+ name : take ('${name }-cognitiveservices-pdns-deployment' , 64 )
210+ params : {
211+ name : 'privatelink.cognitiveservices.${toLower (environment ().name ) == 'azureusgovernment' ? 'azure.us' : 'azure.com' }'
212+ virtualNetworkResourceId : privateNetworking .?virtualNetworkResourceId ?? ''
213+ tags : tags
214+ }
215+ }
216+
217+ module openAiPrivateDnsZone '../privateDnsZone.bicep' = if (!useExistingService && privateNetworking != null && empty (privateNetworking .?openAIPrivateDnsZoneResourceId )) {
218+ name : take ('${name }-openai-pdns-deployment' , 64 )
219+ params : {
220+ name : 'privatelink.openai.${toLower (environment ().name ) == 'azureusgovernment' ? 'azure.us' : 'azure.com' }'
221+ virtualNetworkResourceId : privateNetworking .?virtualNetworkResourceId ?? ''
222+ tags : tags
223+ }
224+ }
225+
226+ module aiServicesPrivateDnsZone '../privateDnsZone.bicep' = if (!useExistingService && privateNetworking != null && empty (privateNetworking .?aiServicesPrivateDnsZoneResourceId )) {
227+ name : take ('${name }-ai-services-pdns-deployment' , 64 )
228+ params : {
229+ name : 'privatelink.services.ai.${toLower (environment ().name ) == 'azureusgovernment' ? 'azure.us' : 'azure.com' }'
230+ virtualNetworkResourceId : privateNetworking .?virtualNetworkResourceId ?? ''
231+ tags : tags
232+ }
233+ }
234+
235+ var cogServicesPrivateDnsZoneResourceId = privateNetworking != null
236+ ? (empty (privateNetworking .?cogServicesPrivateDnsZoneResourceId )
237+ ? cognitiveServicesPrivateDnsZone .outputs .resourceId ?? ''
238+ : privateNetworking .?cogServicesPrivateDnsZoneResourceId )
239+ : ''
240+ var openAIPrivateDnsZoneResourceId = privateNetworking != null
241+ ? (empty (privateNetworking .?openAIPrivateDnsZoneResourceId )
242+ ? openAiPrivateDnsZone .outputs .resourceId ?? ''
243+ : privateNetworking .?openAIPrivateDnsZoneResourceId )
244+ : ''
245+
246+ var aiServicesPrivateDnsZoneResourceId = privateNetworking != null
247+ ? (empty (privateNetworking .?aiServicesPrivateDnsZoneResourceId )
248+ ? aiServicesPrivateDnsZone .outputs .resourceId ?? ''
249+ : privateNetworking .?aiServicesPrivateDnsZoneResourceId )
250+ : ''
251+
208252resource cognitiveServiceNew 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' = if (!useExistingService ) {
209253 name : name
210254 kind : kind
@@ -215,8 +259,8 @@ resource cognitiveServiceNew 'Microsoft.CognitiveServices/accounts@2025-04-01-pr
215259 name : sku
216260 }
217261 properties : {
218- allowProjectManagement : allowProjectManagement // allows project management for Cognitive Services accounts in AI Foundry - FDP updates
219- customSubDomainName : customSubDomainName
262+ allowProjectManagement : true // allows project management for Cognitive Services accounts in AI Foundry - FDP updates
263+ customSubDomainName : name
220264 networkAcls : !empty (networkAcls ?? {})
221265 ? {
222266 defaultAction : networkAcls .?defaultAction
@@ -261,15 +305,43 @@ resource cognitiveServiceExisting 'Microsoft.CognitiveServices/accounts@2025-04-
261305}
262306
263307module cognitive_service_dependencies './dependencies.bicep' = if (!useExistingService ) {
308+ name : take ('${name }-cognitive-service-${cognitiveServiceNew .name }-dependencies' , 64 )
264309 params : {
265310 projectName : projectName
266311 projectDescription : projectDescription
267312 name : cognitiveServiceNew .name
268313 location : location
269314 deployments : deployments
270- diagnosticSettings : diagnosticSettings
315+ diagnosticSettings : !empty (logAnalyticsWorkspaceResourceId )
316+ ? [
317+ {
318+ workspaceResourceId : logAnalyticsWorkspaceResourceId
319+ }
320+ ]
321+ : []
271322 lock : lock
272- privateEndpoints : privateEndpoints
323+ privateEndpoints : privateNetworking != null
324+ ? [
325+ {
326+ name :'pep-${name }-aiservices' // private endpoint name
327+ customNetworkInterfaceName : 'nic-${name }-aiservices'
328+ subnetResourceId : privateNetworking .?subnetResourceId ?? ''
329+ privateDnsZoneGroup : {
330+ privateDnsZoneGroupConfigs : [
331+ {
332+ privateDnsZoneResourceId : cogServicesPrivateDnsZoneResourceId
333+ }
334+ {
335+ privateDnsZoneResourceId : openAIPrivateDnsZoneResourceId
336+ }
337+ {
338+ privateDnsZoneResourceId : aiServicesPrivateDnsZoneResourceId
339+ }
340+ ]
341+ }
342+ }
343+ ]
344+ : []
273345 roleAssignments : roleAssignments
274346 secretsExportConfiguration : secretsExportConfiguration
275347 sku : sku
@@ -278,6 +350,7 @@ module cognitive_service_dependencies './dependencies.bicep' = if(!useExistingSe
278350}
279351
280352module existing_cognitive_service_dependencies './dependencies.bicep' = if (useExistingService ) {
353+ name : take ('existing-${name }-cognitive-service-${cognitiveServiceExisting .name }-dependencies' , 64 )
281354 params : {
282355 name : cognitiveServiceExisting .name
283356 projectName : projectName
0 commit comments