@@ -43,9 +43,11 @@ param appServiceSkuName string // Set in main.parameters.json
43
43
@allowed ([ 'azure' , 'openai' , 'azure_custom' ])
44
44
param openAiHost string // Set in main.parameters.json
45
45
param isAzureOpenAiHost bool = startsWith (openAiHost , 'azure' )
46
+ param deployAzureOpenAi bool = openAiHost == 'azure'
46
47
param azureOpenAiCustomUrl string = ''
47
48
param azureOpenAiApiVersion string = ''
48
-
49
+ @secure ()
50
+ param azureOpenAiApiKey string = ''
49
51
param openAiServiceName string = ''
50
52
param openAiResourceGroupName string = ''
51
53
@@ -66,6 +68,7 @@ param openAiResourceGroupLocation string
66
68
67
69
param openAiSkuName string = 'S0'
68
70
71
+ @secure ()
69
72
param openAiApiKey string = ''
70
73
param openAiApiOrganization string = ''
71
74
@@ -305,17 +308,18 @@ module backend 'core/host/appservice.bicep' = {
305
308
USE_SPEECH_OUTPUT_AZURE : useSpeechOutputAzure
306
309
// Shared by all OpenAI deployments
307
310
OPENAI_HOST : openAiHost
308
- AZURE_OPENAI_CUSTOM_URL : azureOpenAiCustomUrl
309
- AZURE_OPENAI_API_VERSION : azureOpenAiApiVersion
310
311
AZURE_OPENAI_EMB_MODEL_NAME : embedding .modelName
311
312
AZURE_OPENAI_EMB_DIMENSIONS : embedding .dimensions
312
313
AZURE_OPENAI_CHATGPT_MODEL : chatGpt .modelName
313
314
AZURE_OPENAI_GPT4V_MODEL : gpt4vModelName
314
315
// Specific to Azure OpenAI
315
- AZURE_OPENAI_SERVICE : isAzureOpenAiHost ? openAi .outputs .name : ''
316
+ AZURE_OPENAI_SERVICE : isAzureOpenAiHost && deployAzureOpenAi ? openAi .outputs .name : ''
316
317
AZURE_OPENAI_CHATGPT_DEPLOYMENT : chatGpt .deploymentName
317
318
AZURE_OPENAI_EMB_DEPLOYMENT : embedding .deploymentName
318
319
AZURE_OPENAI_GPT4V_DEPLOYMENT : useGPT4V ? gpt4vDeploymentName : ''
320
+ AZURE_OPENAI_API_VERSION : azureOpenAiApiVersion
321
+ AZURE_OPENAI_API_KEY : azureOpenAiApiKey
322
+ AZURE_OPENAI_CUSTOM_URL : azureOpenAiCustomUrl
319
323
// Used only with non-Azure OpenAI deployments
320
324
OPENAI_API_KEY : openAiApiKey
321
325
OPENAI_ORGANIZATION : openAiApiOrganization
@@ -387,7 +391,7 @@ var openAiDeployments = concat(defaultOpenAiDeployments, useGPT4V ? [
387
391
}
388
392
] : [])
389
393
390
- module openAi 'core/ai/cognitiveservices.bicep' = if (isAzureOpenAiHost ) {
394
+ module openAi 'core/ai/cognitiveservices.bicep' = if (isAzureOpenAiHost && deployAzureOpenAi ) {
391
395
name : 'openai'
392
396
scope : openAiResourceGroup
393
397
params : {
@@ -532,7 +536,7 @@ module userStorage 'core/storage/storage-account.bicep' = if (useUserUpload) {
532
536
// USER ROLES
533
537
var principalType = empty (runningOnGh ) && empty (runningOnAdo ) ? 'User' : 'ServicePrincipal'
534
538
535
- module openAiRoleUser 'core/security/role.bicep' = if (isAzureOpenAiHost ) {
539
+ module openAiRoleUser 'core/security/role.bicep' = if (isAzureOpenAiHost && deployAzureOpenAi ) {
536
540
scope : openAiResourceGroup
537
541
name : 'openai-role-user'
538
542
params : {
@@ -624,7 +628,7 @@ module searchSvcContribRoleUser 'core/security/role.bicep' = {
624
628
}
625
629
626
630
// SYSTEM IDENTITIES
627
- module openAiRoleBackend 'core/security/role.bicep' = if (isAzureOpenAiHost ) {
631
+ module openAiRoleBackend 'core/security/role.bicep' = if (isAzureOpenAiHost && deployAzureOpenAi ) {
628
632
scope : openAiResourceGroup
629
633
name : 'openai-role-backend'
630
634
params : {
@@ -634,7 +638,7 @@ module openAiRoleBackend 'core/security/role.bicep' = if (isAzureOpenAiHost) {
634
638
}
635
639
}
636
640
637
- module openAiRoleSearchService 'core/security/role.bicep' = if (isAzureOpenAiHost && useIntegratedVectorization ) {
641
+ module openAiRoleSearchService 'core/security/role.bicep' = if (isAzureOpenAiHost && deployAzureOpenAi && useIntegratedVectorization ) {
638
642
scope : openAiResourceGroup
639
643
name : 'openai-role-searchservice'
640
644
params : {
@@ -829,17 +833,13 @@ output AZURE_OPENAI_CHATGPT_MODEL string = chatGpt.modelName
829
833
output AZURE_OPENAI_GPT4V_MODEL string = gpt4vModelName
830
834
831
835
// Specific to Azure OpenAI
832
- output AZURE_OPENAI_SERVICE string = isAzureOpenAiHost ? openAi .outputs .name : ''
836
+ output AZURE_OPENAI_SERVICE string = isAzureOpenAiHost && deployAzureOpenAi ? openAi .outputs .name : ''
833
837
output AZURE_OPENAI_API_VERSION string = isAzureOpenAiHost ? azureOpenAiApiVersion : ''
834
838
output AZURE_OPENAI_RESOURCE_GROUP string = isAzureOpenAiHost ? openAiResourceGroup .name : ''
835
839
output AZURE_OPENAI_CHATGPT_DEPLOYMENT string = isAzureOpenAiHost ? chatGpt .deploymentName : ''
836
840
output AZURE_OPENAI_EMB_DEPLOYMENT string = isAzureOpenAiHost ? embedding .deploymentName : ''
837
841
output AZURE_OPENAI_GPT4V_DEPLOYMENT string = isAzureOpenAiHost ? gpt4vDeploymentName : ''
838
842
839
- // Used only with non-Azure OpenAI deployments
840
- output OPENAI_API_KEY string = (openAiHost == 'openai' ) ? openAiApiKey : ''
841
- output OPENAI_ORGANIZATION string = (openAiHost == 'openai' ) ? openAiApiOrganization : ''
842
-
843
843
output AZURE_SPEECH_SERVICE_ID string = useSpeechOutputAzure ? speech .outputs .id : ''
844
844
output AZURE_SPEECH_SERVICE_LOCATION string = useSpeechOutputAzure ? speech .outputs .location : ''
845
845
0 commit comments