File tree Expand file tree Collapse file tree 2 files changed +67
-0
lines changed Expand file tree Collapse file tree 2 files changed +67
-0
lines changed Original file line number Diff line number Diff line change 1+ param appName string = ''
2+
3+ @description ('The kind of the app.' )
4+ @allowed ([
5+ 'functionapp'
6+ 'webapp'
7+ ])
8+ param kind string
9+
10+ @description ('Resource ID of log analytics workspace.' )
11+ param diagnosticWorkspaceId string
12+
13+ param diagnosticLogCategoriesToEnable array = kind == 'functionapp' ? [
14+ 'FunctionAppLogs'
15+ ] : [
16+ 'AppServiceHTTPLogs'
17+ 'AppServiceConsoleLogs'
18+ 'AppServiceAppLogs'
19+ 'AppServiceAuditLogs'
20+ 'AppServiceIPSecAuditLogs'
21+ 'AppServicePlatformLogs'
22+ ]
23+
24+ @description ('Optional. The name of metrics that will be streamed.' )
25+ @allowed ([
26+ 'AllMetrics'
27+ ])
28+ param diagnosticMetricsToEnable array = [
29+ 'AllMetrics'
30+ ]
31+
32+
33+ var diagnosticsLogs = [for category in diagnosticLogCategoriesToEnable : {
34+ category : category
35+ enabled : true
36+ }]
37+
38+ var diagnosticsMetrics = [for metric in diagnosticMetricsToEnable : {
39+ category : metric
40+ timeGrain : null
41+ enabled : true
42+ }]
43+
44+ resource app 'Microsoft.Web/sites@2022-03-01' existing = {
45+ name : appName
46+ }
47+
48+ resource app_diagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = {
49+ name : '${appName }-diagnostics'
50+ scope : app
51+ properties : {
52+ workspaceId : diagnosticWorkspaceId
53+ metrics : diagnosticsMetrics
54+ logs : diagnosticsLogs
55+ }
56+ }
Original file line number Diff line number Diff line change @@ -80,6 +80,17 @@ module functionApp 'core/host/functions.bicep' = {
8080 }
8181}
8282
83+
84+ module diagnostics 'core/host/app-diagnostics.bicep' = {
85+ name : '${prefix }-appdiagnostics'
86+ scope : resourceGroup
87+ params : {
88+ appName : functionApp .outputs .name
89+ kind : 'functionapp'
90+ diagnosticWorkspaceId : monitoring .outputs .logAnalyticsWorkspaceId
91+ }
92+ }
93+
8394// CDN in front
8495module cdnProfile 'cdn-profile.bicep' = {
8596 name : 'cdn-profile'
You can’t perform that action at this time.
0 commit comments