-
Notifications
You must be signed in to change notification settings - Fork 214
/
Copy pathdeploy.bicep
165 lines (154 loc) · 4.23 KB
/
deploy.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
@description('Base name to be used in all resources')
param name string = 'cco-ado-contributions'
@description('Name of the storage account')
param staname string = 'ccoadocontsta'
@description('Location where resources should be deployed')
param location string = resourceGroup().location
resource appServicePlan 'Microsoft.Web/serverfarms@2020-06-01' = {
name: '${name}-sp'
location: location
sku: {
name: 'S1'
capacity: 1
}
}
resource appService 'Microsoft.Web/sites@2021-03-01' = {
name: '${name}-fa'
location: location
kind: 'functionapp'
identity: {
type: 'SystemAssigned'
}
properties: {
enabled: true
hostNameSslStates: [
{
hostType: 'Standard'
name: '${name}.azurewebsites.net'
sslState: 'Disabled'
}
{
hostType: 'Repository'
name: '${name}.scm.azurewebsites.net'
sslState: 'Disabled'
}
]
hyperV: false
isXenon: false
reserved: false
scmSiteAlsoStopped: false
serverFarmId: appServicePlan.id
siteConfig: {
numberOfWorkers: 1
acrUseManagedIdentityCreds: false
alwaysOn: true
http20Enabled: false
functionAppScaleLimit: 200
minimumElasticInstanceCount: 1
netFrameworkVersion: 'v4.0'
phpVersion: '5.6'
powerShellVersion: '~7'
}
clientAffinityEnabled: false
clientCertEnabled: false
clientCertMode: 'Required'
hostNamesDisabled: false
containerSize: 1536
dailyMemoryTimeQuota: 0
httpsOnly: true
redundancyMode: 'None'
storageAccountRequired: false
keyVaultReferenceIdentity: 'SystemAssigned'
}
}
resource appServiceLogging 'Microsoft.Web/sites/config@2020-06-01' = {
parent: appService
name: 'appsettings'
properties: {
APPINSIGHTS_INSTRUMENTATIONKEY: appInsights.properties.InstrumentationKey
FUNCTIONS_EXTENSION_VERSION: '~3'
FUNCTIONS_WORKER_RUNTIME: 'powershell'
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};AccountKey=${storageAccount.listKeys().keys[0].value};EndpointSuffix=core.windows.net'
WEBSITE_CONTENTSHARE: appService.name
AzureWebJobsStorage: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};AccountKey=${storageAccount.listKeys().keys[0].value};EndpointSuffix=core.windows.net'
}
dependsOn: [
appServiceSiteExtension
]
}
resource appServiceSiteExtension 'Microsoft.Web/sites/siteextensions@2020-06-01' = {
parent: appService
name: 'Microsoft.ApplicationInsights.AzureWebSites'
dependsOn: [
appInsights
]
}
resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2020-08-01' = {
name: '${name}-la'
location: location
properties: {
sku: {
name: 'PerGB2018'
}
retentionInDays: 120
features: {
searchVersion: 1
legacy: 0
enableLogAccessUsingOnlyResourcePermissions: true
}
}
}
resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
name: '${name}-ai'
location: location
kind: 'web'
properties: {
Application_Type: 'web'
WorkspaceResourceId: logAnalyticsWorkspace.id
}
}
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-08-01' = {
name: staname
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'Storage'
properties: {
minimumTlsVersion: 'TLS1_2'
allowBlobPublicAccess: true
networkAcls: {
bypass: 'AzureServices'
virtualNetworkRules: []
ipRules: []
defaultAction: 'Allow'
}
supportsHttpsTrafficOnly: true
encryption: {
services: {
file: {
keyType: 'Account'
enabled: true
}
blob: {
keyType: 'Account'
enabled: true
}
}
keySource: 'Microsoft.Storage'
}
}
}
resource contributorRoleDefinition 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = {
scope: subscription()
name: 'b24988ac-6180-42a0-ab88-20f7382dd24c'
}
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = {
name: guid(name, 'roleassignment')
scope: storageAccount
properties: {
principalId: appService.identity.principalId
principalType: 'ServicePrincipal'
roleDefinitionId: contributorRoleDefinition.id
}
}