-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.bicep
108 lines (103 loc) · 2.44 KB
/
main.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
param skuName string = 'S1'
param skuCapacity int = 1
param location string = resourceGroup().location
param appName string = uniqueString(resourceGroup().id)
var appServicePlanName = toLower('asp-${appName}')
var webSiteName = toLower('wapp-${appName}')
var appInsightName = toLower('appi-${appName}')
var logAnalyticsName = toLower('la-${appName}')
resource appServicePlan 'Microsoft.Web/serverfarms@2020-06-01' = {
name: appServicePlanName // Globally unique storage account name
location: location // Azure Region
sku: {
name: skuName
capacity: skuCapacity
}
tags: {
displayName: 'HostingPlan'
ProjectName: appName
}
}
resource appService 'Microsoft.Web/sites@2020-06-01' = {
name: webSiteName
location: location
identity: {
type: 'SystemAssigned'
}
tags: {
displayName: 'Website'
ProjectName: appName
}
properties: {
serverFarmId: appServicePlan.id
httpsOnly: true
siteConfig: {
minTlsVersion: '1.2'
}
}
}
resource appServiceLogging 'Microsoft.Web/sites/config@2020-06-01' = {
name: '${appService.name}/logs'
properties: {
applicationLogs: {
fileSystem: {
level: 'Warning'
}
}
httpLogs: {
fileSystem: {
retentionInMb: 40
enabled: true
}
}
failedRequestsTracing: {
enabled: true
}
detailedErrorMessages: {
enabled: true
}
}
}
resource appServiceAppSettings 'Microsoft.Web/sites/config@2020-06-01' = {
name: '${appService.name}/appsettings'
properties: {
APPINSIGHTS_INSTRUMENTATIONKEY: appInsights.properties.InstrumentationKey
}
dependsOn: [
appInsights
appServiceSiteExtension
]
}
resource appServiceSiteExtension 'Microsoft.Web/sites/siteextensions@2020-06-01' = {
name: '${appService.name}/Microsoft.ApplicationInsights.AzureWebsites'
dependsOn: [
appInsights
]
}
resource appInsights 'microsoft.insights/components@2020-02-02-preview' = {
name: appInsightName
location: location
kind: 'string'
tags: {
displayName: 'AppInsight'
ProjectName: appName
}
properties: {
Application_Type: 'web'
WorkspaceResourceId: logAnalyticsWorkspace.id
}
}
resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2020-03-01-preview' = {
name: logAnalyticsName
location: location
tags: {
displayName: 'Log Analytics'
ProjectName: appName
}
properties: {
sku: {
name: 'PerGB2018'
}
retentionInDays: 120
}
}