Skip to content

Commit 4690ac8

Browse files
updated bicep
1 parent 187b85d commit 4690ac8

3 files changed

Lines changed: 64 additions & 10 deletions

File tree

infra/main.bicep

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,16 @@ param vmAdminPassword string?
101101
param tags resourceInput<'Microsoft.Resources/resourceGroups@2025-04-01'>.tags = {}
102102

103103
@description('Optional. Enable monitoring applicable resources, aligned with the Well Architected Framework recommendations. This setting enables Application Insights and Log Analytics and configures all the resources applicable resources to send logs. Defaults to false.')
104-
param enableMonitoring bool = false
104+
param enableMonitoring bool = true
105105

106106
@description('Optional. Enable scalability for applicable resources, aligned with the Well Architected Framework recommendations. Defaults to false.')
107-
param enableScalability bool = false
107+
param enableScalability bool = true
108108

109109
@description('Optional. Enable redundancy for applicable resources, aligned with the Well Architected Framework recommendations. Defaults to false.')
110110
param enableRedundancy bool = false
111111

112112
@description('Optional. Enable private networking for applicable resources, aligned with the Well Architected Framework recommendations. Defaults to false.')
113-
param enablePrivateNetworking bool = false
113+
param enablePrivateNetworking bool = true
114114

115115
@description('Optional. The Container Registry hostname where the docker images are located.')
116116
param acrName string = 'testapwaf'
@@ -948,7 +948,7 @@ module cosmosDB 'br/public:avm/res/document-db/database-account:0.15.0' = {
948948
{
949949
failoverPriority: 0
950950
isZoneRedundant: true
951-
locationName: secondaryLocation
951+
locationName: solutionLocation
952952
}
953953
{
954954
failoverPriority: 1
@@ -1173,7 +1173,7 @@ module webSite 'modules/web-sites.bicep' = {
11731173
UWSGI_PROCESSES: '2'
11741174
UWSGI_THREADS: '2'
11751175
APP_ENV: 'Prod'
1176-
AZURE_CLIENT_ID: userAssignedIdentity.outputs.clientId // NOTE: This is the client ID of the managed identity, not the Entra application, and is needed for the App Service to access the Cosmos DB account.
1176+
AZURE_CLIENT_ID: userAssignedIdentity.outputs.clientId
11771177
}
11781178
// WAF aligned configuration for Monitoring
11791179
applicationInsightResourceId: enableMonitoring ? applicationInsights!.outputs.resourceId : null
@@ -1188,6 +1188,32 @@ module webSite 'modules/web-sites.bicep' = {
11881188
}
11891189
}
11901190

1191+
// ========== App Service Logs Configuration ========== //
1192+
resource webSiteLogs 'Microsoft.Web/sites/config@2024-04-01' = {
1193+
name: '${webSiteResourceName}/logs'
1194+
properties: {
1195+
applicationLogs: {
1196+
fileSystem: {
1197+
level: 'Verbose' // Match the current configuration
1198+
}
1199+
}
1200+
httpLogs: {
1201+
fileSystem: {
1202+
enabled: true
1203+
retentionInDays: 3
1204+
retentionInMb: 100
1205+
}
1206+
}
1207+
detailedErrorMessages: {
1208+
enabled: true
1209+
}
1210+
failedRequestsTracing: {
1211+
enabled: true
1212+
}
1213+
}
1214+
dependsOn: [webSite]
1215+
}
1216+
11911217
@description('Contains WebApp URL')
11921218
output webAppUrl string = 'https://${webSite.outputs.name}.azurewebsites.net'
11931219

infra/main.json

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"_generator": {
77
"name": "bicep",
88
"version": "0.37.4.10188",
9-
"templateHash": "8879061517486739995"
9+
"templateHash": "14511270786246958386"
1010
},
1111
"name": "Document Generation Solution Accelerator",
1212
"description": "CSA CTO Gold Standard Solution Accelerator for Document Generation.\n"
@@ -183,14 +183,14 @@
183183
},
184184
"enableMonitoring": {
185185
"type": "bool",
186-
"defaultValue": false,
186+
"defaultValue": true,
187187
"metadata": {
188188
"description": "Optional. Enable monitoring applicable resources, aligned with the Well Architected Framework recommendations. This setting enables Application Insights and Log Analytics and configures all the resources applicable resources to send logs. Defaults to false."
189189
}
190190
},
191191
"enableScalability": {
192192
"type": "bool",
193-
"defaultValue": false,
193+
"defaultValue": true,
194194
"metadata": {
195195
"description": "Optional. Enable scalability for applicable resources, aligned with the Well Architected Framework recommendations. Defaults to false."
196196
}
@@ -204,7 +204,7 @@
204204
},
205205
"enablePrivateNetworking": {
206206
"type": "bool",
207-
"defaultValue": false,
207+
"defaultValue": true,
208208
"metadata": {
209209
"description": "Optional. Enable private networking for applicable resources, aligned with the Well Architected Framework recommendations. Defaults to false."
210210
}
@@ -418,6 +418,34 @@
418418
"aiSearch"
419419
]
420420
},
421+
"webSiteLogs": {
422+
"type": "Microsoft.Web/sites/config",
423+
"apiVersion": "2024-04-01",
424+
"name": "[format('{0}/logs', variables('webSiteResourceName'))]",
425+
"properties": {
426+
"applicationLogs": {
427+
"fileSystem": {
428+
"level": "Verbose"
429+
}
430+
},
431+
"httpLogs": {
432+
"fileSystem": {
433+
"enabled": true,
434+
"retentionInDays": 3,
435+
"retentionInMb": 100
436+
}
437+
},
438+
"detailedErrorMessages": {
439+
"enabled": true
440+
},
441+
"failedRequestsTracing": {
442+
"enabled": true
443+
}
444+
},
445+
"dependsOn": [
446+
"webSite"
447+
]
448+
},
421449
"logAnalyticsWorkspace": {
422450
"condition": "[and(parameters('enableMonitoring'), not(variables('useExistingLogAnalytics')))]",
423451
"type": "Microsoft.Resources/deployments",
@@ -38382,7 +38410,7 @@
3838238410
"zoneRedundant": "[if(parameters('enableRedundancy'), createObject('value', true()), createObject('value', false()))]",
3838338411
"capabilitiesToAdd": "[if(parameters('enableRedundancy'), createObject('value', null()), createObject('value', createArray('EnableServerless')))]",
3838438412
"automaticFailover": "[if(parameters('enableRedundancy'), createObject('value', true()), createObject('value', false()))]",
38385-
"failoverLocations": "[if(parameters('enableRedundancy'), createObject('value', createArray(createObject('failoverPriority', 0, 'isZoneRedundant', true(), 'locationName', parameters('secondaryLocation')), createObject('failoverPriority', 1, 'isZoneRedundant', true(), 'locationName', variables('cosmosDbHaLocation')))), createObject('value', createArray(createObject('locationName', variables('solutionLocation'), 'failoverPriority', 0))))]"
38413+
"failoverLocations": "[if(parameters('enableRedundancy'), createObject('value', createArray(createObject('failoverPriority', 0, 'isZoneRedundant', true(), 'locationName', variables('solutionLocation')), createObject('failoverPriority', 1, 'isZoneRedundant', true(), 'locationName', variables('cosmosDbHaLocation')))), createObject('value', createArray(createObject('locationName', variables('solutionLocation'), 'failoverPriority', 0))))]"
3838638414
},
3838738415
"template": {
3838838416
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",

0 commit comments

Comments
 (0)