-
Notifications
You must be signed in to change notification settings - Fork 6
/
azuredeploy.json
340 lines (339 loc) · 13.5 KB
/
azuredeploy.json
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"functionAppName": {
"type": "string",
"defaultValue": "[uniqueString(resourceGroup().id)]",
"metadata": {
"description": "Specify the name of the function application"
}
},
"TagName": {
"type": "string",
"defaultValue": "RestartPolicy",
"metadata": {
"description": "Specify the name of the tag for the restart policy"
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Specify the location for the function application resources"
}
},
"ApplicationInsightsLocation": {
"type": "string",
"defaultValue": "North Europe",
"allowedValues": [
"East US",
"South Central US",
"North Europe",
"West Europe",
"Southeast Asia",
"West US 2",
"Central India",
"Canada Central",
"UK South"
],
"metadata": {
"description": "Specify the region for Application Insights data"
}
},
"runtimeStack": {
"type": "string",
"defaultValue": "powershell",
"allowedValues": [
"powershell",
"dotnet",
"node",
"java"
],
"metadata": {
"description": "Pick the language runtime that you want enabled"
}
},
"timezone": {
"type": "string",
"defaultValue": "UTC",
"allowedValues": [
"Dateline Standard Time",
"UTC-11",
"Aleutian Standard Time",
"Hawaiian Standard Time",
"Marquesas Standard Time",
"Alaskan Standard Time",
"UTC-09",
"Pacific Standard Time (Mexico)",
"UTC-08",
"Pacific Standard Time",
"US Mountain Standard Time",
"Mountain Standard Time (Mexico)",
"Mountain Standard Time",
"Central America Standard Time",
"Central Standard Time",
"Easter Island Standard Time",
"Central Standard Time (Mexico)",
"Canada Central Standard Time",
"SA Pacific Standard Time",
"Eastern Standard Time (Mexico)",
"Eastern Standard Time",
"Haiti Standard Time",
"Cuba Standard Time",
"US Eastern Standard Time",
"Turks And Caicos Standard Time",
"Paraguay Standard Time",
"Atlantic Standard Time",
"Venezuela Standard Time",
"Central Brazilian Standard Time",
"SA Western Standard Time",
"Pacific SA Standard Time",
"Newfoundland Standard Time",
"Tocantins Standard Time",
"E. South America Standard Time",
"SA Eastern Standard Time",
"Argentina Standard Time",
"Greenland Standard Time",
"Montevideo Standard Time",
"Magallanes Standard Time",
"Saint Pierre Standard Time",
"Bahia Standard Time",
"UTC-02",
"Mid-Atlantic Standard Time",
"Azores Standard Time",
"Cape Verde Standard Time",
"UTC",
"Morocco Standard Time",
"GMT Standard Time",
"Greenwich Standard Time",
"W. Europe Standard Time",
"Central Europe Standard Time",
"Romance Standard Time",
"Sao Tome Standard Time",
"Central European Standard Time",
"W. Central Africa Standard Time",
"Jordan Standard Time",
"GTB Standard Time",
"Middle East Standard Time",
"Egypt Standard Time",
"E. Europe Standard Time",
"Syria Standard Time",
"West Bank Standard Time",
"South Africa Standard Time",
"FLE Standard Time",
"Israel Standard Time",
"Kaliningrad Standard Time",
"Sudan Standard Time",
"Libya Standard Time",
"Namibia Standard Time",
"Arabic Standard Time",
"Turkey Standard Time",
"Arab Standard Time",
"Belarus Standard Time",
"Russian Standard Time",
"E. Africa Standard Time",
"Iran Standard Time",
"Arabian Standard Time",
"Astrakhan Standard Time",
"Azerbaijan Standard Time",
"Russia Time Zone 3",
"Mauritius Standard Time",
"Saratov Standard Time",
"Georgian Standard Time",
"Caucasus Standard Time",
"Afghanistan Standard Time",
"West Asia Standard Time",
"Ekaterinburg Standard Time",
"Pakistan Standard Time",
"India Standard Time",
"Sri Lanka Standard Time",
"Nepal Standard Time",
"Central Asia Standard Time",
"Bangladesh Standard Time",
"Omsk Standard Time",
"Myanmar Standard Time",
"SE Asia Standard Time",
"Altai Standard Time",
"W. Mongolia Standard Time",
"North Asia Standard Time",
"N. Central Asia Standard Time",
"Tomsk Standard Time",
"China Standard Time",
"North Asia East Standard Time",
"Singapore Standard Time",
"W. Australia Standard Time",
"Taipei Standard Time",
"Ulaanbaatar Standard Time",
"Aus Central W. Standard Time",
"Transbaikal Standard Time",
"Tokyo Standard Time",
"North Korea Standard Time",
"Korea Standard Time",
"Yakutsk Standard Time",
"Cen. Australia Standard Time",
"AUS Central Standard Time",
"E. Australia Standard Time",
"AUS Eastern Standard Time",
"West Pacific Standard Time",
"Tasmania Standard Time",
"Vladivostok Standard Time",
"Lord Howe Standard Time",
"Bougainville Standard Time",
"Russia Time Zone 10",
"Magadan Standard Time",
"Norfolk Standard Time",
"Sakhalin Standard Time",
"Central Pacific Standard Time",
"Russia Time Zone 11",
"New Zealand Standard Time",
"UTC+12",
"Fiji Standard Time",
"Kamchatka Standard Time",
"Chatham Islands Standard Time",
"UTC+13",
"Tonga Standard Time",
"Samoa Standard Time",
"Line Islands Standard Time"
],
"metadata": {
"description": "Pick the timezone to use for the function"
}
}
},
"variables": {
"hostingPlanName": "[concat(parameters('functionAppName'), '-plan')]",
"storageAccountName": "[concat('stofunc', uniquestring(resourceGroup().id))]",
"BlobContainerName": "logs",
"GithubUri": "https://github.com/omiossec/StartStopVmByTag",
"prodbranch": "master"
},
"resources": [
{
"name": "[parameters('functionAppName')]",
"type": "Microsoft.Web/sites",
"apiVersion": "2018-02-01",
"location": "[parameters('location')]",
"kind": "functionapp",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms/', variables('hostingPlanName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
"[resourceId('microsoft.insights/components/', parameters('functionAppName'))]"
],
"identity": {
"type": "SystemAssigned"
},
"properties": {
"siteConfig": {
"appSettings": [
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "[parameters('runtimeStack')]"
},
{
"name": "TagName",
"value": "[parameters('TagName')]"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2017-06-01').keys[0].value)]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~2"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference(resourceId('microsoft.insights/components/', parameters('functionAppName')), '2018-05-01-preview').InstrumentationKey]"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')),'2017-06-01').keys[0].value)]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[toLower(parameters('functionAppName'))]"
},
{
"name": "WEBSITE_TIME_ZONE",
"value": "[parameters('timezone')]"
}
]
},
"name": "[parameters('functionAppName')]",
"clientAffinityEnabled": false,
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms/', variables('hostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "sourcecontrols",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites/', parameters('functionAppName'))]"
],
"properties": {
"RepoUrl": "[variables('GithubUri')]",
"branch": "[variables('prodbranch')]",
"IsManualIntegration": true
}
}
]
},
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-11-01",
"name": "[variables('hostingPlanName')]",
"location": "[parameters('location')]",
"properties": {
"name": "[variables('hostingPlanName')]"
},
"sku": {
"name": "Y1",
"tier": "Dynamic",
"size": "Y1",
"family": "Y",
"capacity": 0
}
},
{
"name": "[variables('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2018-07-01",
"location": "[parameters('location')]",
"kind": "StorageV2",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"accessTier": "Hot"
},
"resources": [
{
"name": "[concat('default/', variables('BlobContainerName'))]",
"type": "blobServices/containers",
"apiVersion": "2018-07-01",
"dependsOn": [
"[variables('storageAccountName')]"
]
}
]
},
{
"apiVersion": "2018-05-01-preview",
"name": "[parameters('functionAppName')]",
"type": "Microsoft.Insights/components",
"location": "[parameters('ApplicationInsightsLocation')]",
"properties": {
"ApplicationId": "[parameters('functionAppName')]"
}
}
],
"outputs": {
"principalId": {
"type": "string",
"value": "[reference(concat(resourceId('Microsoft.Web/sites/', parameters('functionAppName')), '/providers/Microsoft.ManagedIdentity/Identities/default'), '2015-08-31-PREVIEW').principalId]"
}
}
}