Skip to content

Commit bce51c0

Browse files
committed
Run format on main.bicep
1 parent 2333426 commit bce51c0

File tree

1 file changed

+106
-64
lines changed

1 file changed

+106
-64
lines changed

infra/main.bicep

Lines changed: 106 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ param searchServiceName string = '' // Set in main.parameters.json
2121
param searchServiceResourceGroupName string = '' // Set in main.parameters.json
2222
param searchServiceLocation string = '' // Set in main.parameters.json
2323
// The free tier does not support managed identity (required) or semantic search (optional)
24-
@allowed([ 'free', 'basic', 'standard', 'standard2', 'standard3', 'storage_optimized_l1', 'storage_optimized_l2' ])
24+
@allowed(['free', 'basic', 'standard', 'standard2', 'standard3', 'storage_optimized_l1', 'storage_optimized_l2'])
2525
param searchServiceSkuName string // Set in main.parameters.json
2626
param searchIndexName string // Set in main.parameters.json
2727
param searchQueryLanguage string // Set in main.parameters.json
2828
param searchQuerySpeller string // Set in main.parameters.json
2929
param searchServiceSemanticRankerLevel string // Set in main.parameters.json
30-
var actualSearchServiceSemanticRankerLevel = (searchServiceSkuName == 'free') ? 'disabled' : searchServiceSemanticRankerLevel
30+
var actualSearchServiceSemanticRankerLevel = (searchServiceSkuName == 'free')
31+
? 'disabled'
32+
: searchServiceSemanticRankerLevel
3133

3234
param storageAccountName string = '' // Set in main.parameters.json
3335
param storageResourceGroupName string = '' // Set in main.parameters.json
@@ -40,7 +42,7 @@ param userStorageContainerName string = 'user-content'
4042

4143
param appServiceSkuName string // Set in main.parameters.json
4244

43-
@allowed([ 'azure', 'openai', 'azure_custom' ])
45+
@allowed(['azure', 'openai', 'azure_custom'])
4446
param openAiHost string // Set in main.parameters.json
4547
param isAzureOpenAiHost bool = startsWith(openAiHost, 'azure')
4648
param deployAzureOpenAi bool = openAiHost == 'azure'
@@ -58,7 +60,18 @@ param speechServiceSkuName string // Set in main.parameters.json
5860
param useGPT4V bool = false
5961

6062
@description('Location for the OpenAI resource group')
61-
@allowed([ 'canadaeast', 'eastus', 'eastus2', 'francecentral', 'switzerlandnorth', 'uksouth', 'japaneast', 'northcentralus', 'australiaeast', 'swedencentral' ])
63+
@allowed([
64+
'canadaeast'
65+
'eastus'
66+
'eastus2'
67+
'francecentral'
68+
'switzerlandnorth'
69+
'uksouth'
70+
'japaneast'
71+
'northcentralus'
72+
'australiaeast'
73+
'swedencentral'
74+
])
6275
@metadata({
6376
azd: {
6477
type: 'location'
@@ -78,7 +91,7 @@ param documentIntelligenceResourceGroupName string = '' // Set in main.parameter
7891
// Limited regions for new version:
7992
// https://learn.microsoft.com/azure/ai-services/document-intelligence/concept-layout
8093
@description('Location for the Document Intelligence resource group')
81-
@allowed([ 'eastus', 'westus2', 'westeurope' ])
94+
@allowed(['eastus', 'westus2', 'westeurope'])
8295
@metadata({
8396
azd: {
8497
type: 'location'
@@ -98,7 +111,9 @@ param chatGptDeploymentName string = ''
98111
param chatGptDeploymentVersion string = ''
99112
param chatGptDeploymentCapacity int = 0
100113
var chatGpt = {
101-
modelName: !empty(chatGptModelName) ? chatGptModelName : startsWith(openAiHost, 'azure') ? 'gpt-35-turbo' : 'gpt-3.5-turbo'
114+
modelName: !empty(chatGptModelName)
115+
? chatGptModelName
116+
: startsWith(openAiHost, 'azure') ? 'gpt-35-turbo' : 'gpt-3.5-turbo'
102117
deploymentName: !empty(chatGptDeploymentName) ? chatGptDeploymentName : 'chat'
103118
deploymentVersion: !empty(chatGptDeploymentVersion) ? chatGptDeploymentVersion : '0613'
104119
deploymentCapacity: chatGptDeploymentCapacity != 0 ? chatGptDeploymentCapacity : 30
@@ -143,12 +158,12 @@ param clientAppSecret string = ''
143158
// Used for optional CORS support for alternate frontends
144159
param allowedOrigin string = '' // should start with https://, shouldn't end with a /
145160

146-
@allowed([ 'None', 'AzureServices' ])
161+
@allowed(['None', 'AzureServices'])
147162
@description('If allowedIp is set, whether azure services are allowed to bypass the storage and AI services firewall.')
148163
param bypass string = 'AzureServices'
149164

150165
@description('Public network access value for all deployed resources')
151-
@allowed([ 'Enabled', 'Disabled' ])
166+
@allowed(['Enabled', 'Disabled'])
152167
param publicNetworkAccess string = 'Enabled'
153168

154169
@description('Add a private endpoints for network connectivity')
@@ -229,8 +244,12 @@ module monitoring 'core/monitor/monitoring.bicep' = if (useApplicationInsights)
229244
params: {
230245
location: location
231246
tags: tags
232-
applicationInsightsName: !empty(applicationInsightsName) ? applicationInsightsName : '${abbrs.insightsComponents}${resourceToken}'
233-
logAnalyticsName: !empty(logAnalyticsName) ? logAnalyticsName : '${abbrs.operationalInsightsWorkspaces}${resourceToken}'
247+
applicationInsightsName: !empty(applicationInsightsName)
248+
? applicationInsightsName
249+
: '${abbrs.insightsComponents}${resourceToken}'
250+
logAnalyticsName: !empty(logAnalyticsName)
251+
? logAnalyticsName
252+
: '${abbrs.operationalInsightsWorkspaces}${resourceToken}'
234253
publicNetworkAccess: publicNetworkAccess
235254
}
236255
}
@@ -239,7 +258,9 @@ module applicationInsightsDashboard 'backend-dashboard.bicep' = if (useApplicati
239258
name: 'application-insights-dashboard'
240259
scope: resourceGroup
241260
params: {
242-
name: !empty(applicationInsightsDashboardName) ? applicationInsightsDashboardName : '${abbrs.portalDashboards}${resourceToken}'
261+
name: !empty(applicationInsightsDashboardName)
262+
? applicationInsightsDashboardName
263+
: '${abbrs.portalDashboards}${resourceToken}'
243264
location: location
244265
applicationInsightsName: useApplicationInsights ? monitoring.outputs.applicationInsightsName : ''
245266
}
@@ -277,7 +298,7 @@ module backend 'core/host/appservice.bicep' = {
277298
managedIdentity: true
278299
virtualNetworkSubnetId: isolation.outputs.appSubnetId
279300
publicNetworkAccess: publicNetworkAccess
280-
allowedOrigins: [ allowedOrigin ]
301+
allowedOrigins: [allowedOrigin]
281302
clientAppId: clientAppId
282303
serverAppId: serverAppId
283304
enableUnauthenticatedAccess: enableUnauthenticatedAccess
@@ -295,7 +316,9 @@ module backend 'core/host/appservice.bicep' = {
295316
AZURE_VISION_ENDPOINT: useGPT4V ? computerVision.outputs.endpoint : ''
296317
AZURE_SEARCH_QUERY_LANGUAGE: searchQueryLanguage
297318
AZURE_SEARCH_QUERY_SPELLER: searchQuerySpeller
298-
APPLICATIONINSIGHTS_CONNECTION_STRING: useApplicationInsights ? monitoring.outputs.applicationInsightsConnectionString : ''
319+
APPLICATIONINSIGHTS_CONNECTION_STRING: useApplicationInsights
320+
? monitoring.outputs.applicationInsightsConnectionString
321+
: ''
299322
AZURE_SPEECH_SERVICE_ID: useSpeechOutputAzure ? speech.outputs.resourceId : ''
300323
AZURE_SPEECH_SERVICE_LOCATION: useSpeechOutputAzure ? speech.outputs.location : ''
301324
ENABLE_LANGUAGE_PICKER: enableLanguagePicker
@@ -372,20 +395,25 @@ var defaultOpenAiDeployments = [
372395
}
373396
]
374397

375-
var openAiDeployments = concat(defaultOpenAiDeployments, useGPT4V ? [
376-
{
377-
name: gpt4vDeploymentName
378-
model: {
379-
format: 'OpenAI'
380-
name: gpt4vModelName
381-
version: gpt4vModelVersion
382-
}
383-
sku: {
384-
name: 'Standard'
385-
capacity: gpt4vDeploymentCapacity
386-
}
387-
}
388-
] : [])
398+
var openAiDeployments = concat(
399+
defaultOpenAiDeployments,
400+
useGPT4V
401+
? [
402+
{
403+
name: gpt4vDeploymentName
404+
model: {
405+
format: 'OpenAI'
406+
name: gpt4vModelName
407+
version: gpt4vModelVersion
408+
}
409+
sku: {
410+
name: 'Standard'
411+
capacity: gpt4vDeploymentCapacity
412+
}
413+
}
414+
]
415+
: []
416+
)
389417

390418
module openAi 'br/public:avm/res/cognitive-services/account:0.5.4' = if (isAzureOpenAiHost && deployAzureOpenAi) {
391419
name: 'openai'
@@ -395,7 +423,9 @@ module openAi 'br/public:avm/res/cognitive-services/account:0.5.4' = if (isAzure
395423
location: openAiResourceGroupLocation
396424
tags: tags
397425
kind: 'OpenAI'
398-
customSubDomainName: !empty(openAiServiceName) ? openAiServiceName : '${abbrs.cognitiveServicesAccounts}${resourceToken}'
426+
customSubDomainName: !empty(openAiServiceName)
427+
? openAiServiceName
428+
: '${abbrs.cognitiveServicesAccounts}${resourceToken}'
399429
publicNetworkAccess: publicNetworkAccess
400430
networkAcls: {
401431
defaultAction: 'Allow'
@@ -413,9 +443,13 @@ module documentIntelligence 'br/public:avm/res/cognitive-services/account:0.5.4'
413443
name: 'documentintelligence'
414444
scope: documentIntelligenceResourceGroup
415445
params: {
416-
name: !empty(documentIntelligenceServiceName) ? documentIntelligenceServiceName : '${abbrs.cognitiveServicesDocumentIntelligence}${resourceToken}'
446+
name: !empty(documentIntelligenceServiceName)
447+
? documentIntelligenceServiceName
448+
: '${abbrs.cognitiveServicesDocumentIntelligence}${resourceToken}'
417449
kind: 'FormRecognizer'
418-
customSubDomainName: !empty(documentIntelligenceServiceName) ? documentIntelligenceServiceName : '${abbrs.cognitiveServicesDocumentIntelligence}${resourceToken}'
450+
customSubDomainName: !empty(documentIntelligenceServiceName)
451+
? documentIntelligenceServiceName
452+
: '${abbrs.cognitiveServicesDocumentIntelligence}${resourceToken}'
419453
publicNetworkAccess: publicNetworkAccess
420454
networkAcls: {
421455
defaultAction: 'Allow'
@@ -456,7 +490,9 @@ module speech 'br/public:avm/res/cognitive-services/account:0.5.4' = if (useSpee
456490
networkAcls: {
457491
defaultAction: 'Allow'
458492
}
459-
customSubDomainName: !empty(speechServiceName) ? speechServiceName : '${abbrs.cognitiveServicesSpeech}${resourceToken}'
493+
customSubDomainName: !empty(speechServiceName)
494+
? speechServiceName
495+
: '${abbrs.cognitiveServicesSpeech}${resourceToken}'
460496
location: !empty(speechServiceLocation) ? speechServiceLocation : location
461497
tags: tags
462498
sku: speechServiceSkuName
@@ -474,8 +510,10 @@ module searchService 'core/search/search-services.bicep' = {
474510
name: searchServiceSkuName
475511
}
476512
semanticSearch: actualSearchServiceSemanticRankerLevel
477-
publicNetworkAccess: publicNetworkAccess == 'Enabled' ? 'enabled' : (publicNetworkAccess == 'Disabled' ? 'disabled' : null)
478-
sharedPrivateLinkStorageAccounts: usePrivateEndpoint ? [ storage.outputs.id ] : []
513+
publicNetworkAccess: publicNetworkAccess == 'Enabled'
514+
? 'enabled'
515+
: (publicNetworkAccess == 'Disabled' ? 'disabled' : null)
516+
sharedPrivateLinkStorageAccounts: usePrivateEndpoint ? [storage.outputs.id] : []
479517
}
480518
}
481519

@@ -519,7 +557,9 @@ module userStorage 'core/storage/storage-account.bicep' = if (useUserUpload) {
519557
name: 'user-storage'
520558
scope: storageResourceGroup
521559
params: {
522-
name: !empty(userStorageAccountName) ? userStorageAccountName : 'user${abbrs.storageStorageAccounts}${resourceToken}'
560+
name: !empty(userStorageAccountName)
561+
? userStorageAccountName
562+
: 'user${abbrs.storageStorageAccounts}${resourceToken}'
523563
location: storageResourceGroupLocation
524564
tags: tags
525565
publicNetworkAccess: publicNetworkAccess
@@ -720,36 +760,38 @@ module isolation 'network-isolation.bicep' = {
720760

721761
var environmentData = environment()
722762

723-
var openAiPrivateEndpointConnection = (isAzureOpenAiHost && deployAzureOpenAi) ? [{
724-
groupId: 'account'
725-
dnsZoneName: 'privatelink.openai.azure.com'
726-
resourceIds: concat(
727-
[ openAi.outputs.resourceId ],
728-
useGPT4V ? [ computerVision.outputs.resourceId ] : [],
729-
!useLocalPdfParser ? [ documentIntelligence.outputs.resourceId ] : []
730-
)
731-
}] : []
732-
var otherPrivateEndpointConnections = usePrivateEndpoint ? [
733-
{
734-
groupId: 'blob'
735-
dnsZoneName: 'privatelink.blob.${environmentData.suffixes.storage}'
736-
resourceIds: concat(
737-
[ storage.outputs.id ],
738-
useUserUpload ? [ userStorage.outputs.id ] : []
739-
)
740-
}
741-
{
742-
groupId: 'searchService'
743-
dnsZoneName: 'privatelink.search.windows.net'
744-
resourceIds: [ searchService.outputs.id ]
745-
}
746-
{
747-
groupId: 'sites'
748-
dnsZoneName: 'privatelink.azurewebsites.net'
749-
resourceIds: [ backend.outputs.id ]
750-
}
751-
] : []
752-
763+
var openAiPrivateEndpointConnection = (isAzureOpenAiHost && deployAzureOpenAi)
764+
? [
765+
{
766+
groupId: 'account'
767+
dnsZoneName: 'privatelink.openai.azure.com'
768+
resourceIds: concat(
769+
[openAi.outputs.resourceId],
770+
useGPT4V ? [computerVision.outputs.resourceId] : [],
771+
!useLocalPdfParser ? [documentIntelligence.outputs.resourceId] : []
772+
)
773+
}
774+
]
775+
: []
776+
var otherPrivateEndpointConnections = usePrivateEndpoint
777+
? [
778+
{
779+
groupId: 'blob'
780+
dnsZoneName: 'privatelink.blob.${environmentData.suffixes.storage}'
781+
resourceIds: concat([storage.outputs.id], useUserUpload ? [userStorage.outputs.id] : [])
782+
}
783+
{
784+
groupId: 'searchService'
785+
dnsZoneName: 'privatelink.search.windows.net'
786+
resourceIds: [searchService.outputs.id]
787+
}
788+
{
789+
groupId: 'sites'
790+
dnsZoneName: 'privatelink.azurewebsites.net'
791+
resourceIds: [backend.outputs.id]
792+
}
793+
]
794+
: []
753795

754796
var privateEndpointConnections = concat(otherPrivateEndpointConnections, openAiPrivateEndpointConnection)
755797

0 commit comments

Comments
 (0)