Skip to content

Commit b49a89c

Browse files
Use AVM for all Cognitive Services accounts and services (#1818)
* Use AVM for OpenAI deployment * Use AVM for CV, Speech Services and Doc Intelligence * Add network ACLs to all resource types. --------- Co-authored-by: Pamela Fox <[email protected]>
1 parent 58747a1 commit b49a89c

File tree

2 files changed

+32
-82
lines changed

2 files changed

+32
-82
lines changed

infra/core/ai/cognitiveservices.bicep

Lines changed: 0 additions & 60 deletions
This file was deleted.

infra/main.bicep

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ module backend 'core/host/appservice.bicep' = {
301301
AZURE_SEARCH_QUERY_LANGUAGE: searchQueryLanguage
302302
AZURE_SEARCH_QUERY_SPELLER: searchQuerySpeller
303303
APPLICATIONINSIGHTS_CONNECTION_STRING: useApplicationInsights ? monitoring.outputs.applicationInsightsConnectionString : ''
304-
AZURE_SPEECH_SERVICE_ID: useSpeechOutputAzure ? speech.outputs.id : ''
304+
AZURE_SPEECH_SERVICE_ID: useSpeechOutputAzure ? speech.outputs.resourceId : ''
305305
AZURE_SPEECH_SERVICE_LOCATION: useSpeechOutputAzure ? speech.outputs.location : ''
306306
USE_SPEECH_INPUT_BROWSER: useSpeechInputBrowser
307307
USE_SPEECH_OUTPUT_BROWSER: useSpeechOutputBrowser
@@ -391,69 +391,79 @@ var openAiDeployments = concat(defaultOpenAiDeployments, useGPT4V ? [
391391
}
392392
] : [])
393393

394-
module openAi 'core/ai/cognitiveservices.bicep' = if (isAzureOpenAiHost && deployAzureOpenAi) {
394+
module openAi 'br/public:avm/res/cognitive-services/account:0.5.4' = if (isAzureOpenAiHost && deployAzureOpenAi) {
395395
name: 'openai'
396396
scope: openAiResourceGroup
397397
params: {
398398
name: !empty(openAiServiceName) ? openAiServiceName : '${abbrs.cognitiveServicesAccounts}${resourceToken}'
399399
location: openAiResourceGroupLocation
400400
tags: tags
401+
kind: 'OpenAI'
402+
customSubDomainName: !empty(openAiServiceName) ? openAiServiceName : '${abbrs.cognitiveServicesAccounts}${resourceToken}'
401403
publicNetworkAccess: publicNetworkAccess
402-
bypass: bypass
403-
sku: {
404-
name: openAiSkuName
404+
networkAcls: {
405+
defaultAction: 'Allow'
406+
bypass: bypass
405407
}
408+
sku: openAiSkuName
406409
deployments: openAiDeployments
407410
disableLocalAuth: true
408411
}
409412
}
410413

411414
// Formerly known as Form Recognizer
412415
// Does not support bypass
413-
module documentIntelligence 'core/ai/cognitiveservices.bicep' = {
416+
module documentIntelligence 'br/public:avm/res/cognitive-services/account:0.5.4' = {
414417
name: 'documentintelligence'
415418
scope: documentIntelligenceResourceGroup
416419
params: {
417420
name: !empty(documentIntelligenceServiceName) ? documentIntelligenceServiceName : '${abbrs.cognitiveServicesDocumentIntelligence}${resourceToken}'
418421
kind: 'FormRecognizer'
422+
customSubDomainName: !empty(documentIntelligenceServiceName) ? documentIntelligenceServiceName : '${abbrs.cognitiveServicesDocumentIntelligence}${resourceToken}'
419423
publicNetworkAccess: publicNetworkAccess
424+
networkAcls: {
425+
defaultAction: 'Allow'
426+
}
420427
location: documentIntelligenceResourceGroupLocation
421428
disableLocalAuth: true
422429
tags: tags
423-
sku: {
424-
name: documentIntelligenceSkuName
425-
}
430+
sku: documentIntelligenceSkuName
426431
}
427432
}
428433

429-
module computerVision 'core/ai/cognitiveservices.bicep' = if (useGPT4V) {
434+
module computerVision 'br/public:avm/res/cognitive-services/account:0.5.4' = if (useGPT4V) {
430435
name: 'computerVision'
431436
scope: computerVisionResourceGroup
432437
params: {
433438
name: !empty(computerVisionServiceName)
434439
? computerVisionServiceName
435440
: '${abbrs.cognitiveServicesComputerVision}${resourceToken}'
436441
kind: 'ComputerVision'
442+
networkAcls: {
443+
defaultAction: 'Allow'
444+
}
445+
customSubDomainName: !empty(computerVisionServiceName)
446+
? computerVisionServiceName
447+
: '${abbrs.cognitiveServicesComputerVision}${resourceToken}'
437448
location: computerVisionResourceGroupLocation
438449
tags: tags
439-
bypass: bypass
440-
sku: {
441-
name: computerVisionSkuName
442-
}
450+
sku: computerVisionSkuName
443451
}
444452
}
445453

446-
module speech 'core/ai/cognitiveservices.bicep' = if (useSpeechOutputAzure) {
454+
module speech 'br/public:avm/res/cognitive-services/account:0.5.4' = if (useSpeechOutputAzure) {
447455
name: 'speech-service'
448456
scope: speechResourceGroup
449457
params: {
450458
name: !empty(speechServiceName) ? speechServiceName : '${abbrs.cognitiveServicesSpeech}${resourceToken}'
451459
kind: 'SpeechServices'
460+
networkAcls: {
461+
defaultAction: 'Allow'
462+
}
463+
customSubDomainName: !empty(speechServiceName) ? speechServiceName : '${abbrs.cognitiveServicesSpeech}${resourceToken}'
452464
location: !empty(speechServiceLocation) ? speechServiceLocation : location
453465
tags: tags
454-
sku: {
455-
name: speechServiceSkuName
456-
}
466+
sku: speechServiceSkuName
457467
}
458468
}
459469
module searchService 'core/search/search-services.bicep' = {
@@ -720,9 +730,9 @@ var openAiPrivateEndpointConnection = (isAzureOpenAiHost && deployAzureOpenAi) ?
720730
groupId: 'account'
721731
dnsZoneName: 'privatelink.openai.azure.com'
722732
resourceIds: concat(
723-
[ openAi.outputs.id ],
724-
useGPT4V ? [ computerVision.outputs.id ] : [],
725-
!useLocalPdfParser ? [ documentIntelligence.outputs.id ] : []
733+
[ openAi.outputs.resourceId ],
734+
useGPT4V ? [ computerVision.outputs.resourceId ] : [],
735+
!useLocalPdfParser ? [ documentIntelligence.outputs.resourceId ] : []
726736
)
727737
}] : []
728738
var otherPrivateEndpointConnections = usePrivateEndpoint ? [
@@ -844,7 +854,7 @@ output AZURE_OPENAI_CHATGPT_DEPLOYMENT string = isAzureOpenAiHost ? chatGpt.depl
844854
output AZURE_OPENAI_EMB_DEPLOYMENT string = isAzureOpenAiHost ? embedding.deploymentName : ''
845855
output AZURE_OPENAI_GPT4V_DEPLOYMENT string = isAzureOpenAiHost ? gpt4vDeploymentName : ''
846856

847-
output AZURE_SPEECH_SERVICE_ID string = useSpeechOutputAzure ? speech.outputs.id : ''
857+
output AZURE_SPEECH_SERVICE_ID string = useSpeechOutputAzure ? speech.outputs.resourceId : ''
848858
output AZURE_SPEECH_SERVICE_LOCATION string = useSpeechOutputAzure ? speech.outputs.location : ''
849859

850860
output AZURE_VISION_ENDPOINT string = useGPT4V ? computerVision.outputs.endpoint : ''

0 commit comments

Comments
 (0)