-
Notifications
You must be signed in to change notification settings - Fork 1
/
logging.bicep
48 lines (45 loc) · 1.16 KB
/
logging.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
param appName string
param location string = resourceGroup().location
var appInsightName = toLower('appi-${appName}')
var logAnalyticsName = toLower('la-${appName}')
resource appServiceAppSettings 'Microsoft.Web/sites/config@2020-06-01' = {
name: '${appName}/appsettings'
properties: {
APPINSIGHTS_INSTRUMENTATIONKEY: appInsights.properties.InstrumentationKey
}
dependsOn: [
appInsights
appServiceSiteExtension
]
}
resource appServiceSiteExtension 'Microsoft.Web/sites/siteextensions@2020-06-01' = {
name: '${appName}/Microsoft.ApplicationInsights.AzureWebsites'
dependsOn: [
appInsights
]
}
resource appInsights 'microsoft.insights/components@2020-02-02-preview' = {
name: appInsightName
location: location
kind: 'string'
tags: {
displayName: 'AppInsight'
}
properties: {
Application_Type: 'web'
WorkspaceResourceId: logAnalyticsWorkspace.id
}
}
resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2020-03-01-preview' = {
name: logAnalyticsName
location: location
tags: {
displayName: 'Log Analytics'
}
properties: {
sku: {
name: 'PerGB2018'
}
retentionInDays: 120
}
}