/
azuredeploy.json
415 lines (414 loc) · 17 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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"SQL DW Resource Group": {
"type": "String",
"metadata": {
"description": "The resource group of your pre-existing SQL Data Warehouse."
}
},
"SQL DW Logical Server": {
"type": "String",
"metadata": {
"description": "The server name of your pre-existing SQL Data Warehouse."
}
},
"SQL DW Name": {
"type": "String",
"metadata": {
"description": "The database name of your pre-existing SQL Data Warehouse."
}
},
"SQL DW Region": {
"type": "String",
"metadata": {
"description": "The location of your SQL Data Warehouse instance West US 2 becomes westus2."
}
},
"Storage Account Type": {
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_RAGRS"
],
"type": "String",
"metadata": {
"description": "Storage Account type that will be used to host logs and the queue mechanism."
}
},
"Azure Active Directory ID": {
"type": "String",
"metadata": "Azure Active Directory ID where Serivce Principal Account was created."
},
"Subscription ID": {
"type": "String",
"metadata": "Subscription GUID of the the subscription where the SQL Data Warehouse instance resides."
},
"Service Principal Application ID": {
"type": "String",
"metadata": "Application Id of the Service Principal account with access to SQL Data Warehouse instance."
},
"Service Principal Secret Key": {
"type": "SecureString",
"metadata": "Secret Key of the Service Principal account."
},
"WEBSITE_TIME_ZONE": {
"type": "String",
"metadata": "Timezone relative to the schedule. Consult https://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).aspx for more information",
"allowedValues": [
"Dateline Standard Time",
"Samoa Standard Time",
"Hawaiian Standard Time",
"Alaskan Standard Time",
"Pacific Standard Time",
"Mountain Standard Time",
"Mexico Standard Time 2",
"U.S. Mountain Standard Time",
"Central Standard Time",
"Canada Central Standard Time",
"Mexico Standard Time",
"Central America Standard Time",
"Eastern Standard Time",
"U.S. Eastern Standard Time",
"S.A. Pacific Standard Time",
"Atlantic Standard Time",
"S.A. Western Standard Time",
"Pacific S.A. Standard Time",
"Newfoundland and Labrador Standard Time",
"E. South America Standard Time",
"S.A. Eastern Standard Time",
"Greenland Standard Time",
"Mid-Atlantic Standard Time",
"Azores Standard Time",
"Cape Verde Standard Time",
"GMT Standard Time",
"Greenwich Standard Time",
"Central Europe Standard Time",
"Central European Standard Time",
"Romance Standard Time",
"W. Europe Standard Time",
"W. Central Africa Standard Time",
"E. Europe Standard Time",
"Egypt Standard Time",
"FLE Standard Time",
"GTB Standard Time",
"Israel Standard Time",
"South Africa Standard Time",
"Russian Standard Time",
"Arab Standard Time",
"E. Africa Standard Time",
"Arabic Standard Time",
"Iran Standard Time",
"Arabian Standard Time",
"Caucasus Standard Time",
"Transitional Islamic State of Afghanistan Standard Time",
"Ekaterinburg Standard Time",
"West Asia Standard Time",
"India Standard Time",
"Nepal Standard Time",
"Central Asia Standard Time",
"Sri Lanka Standard Time",
"N. Central Asia Standard Time",
"Myanmar Standard Time",
"S.E. Asia Standard Time",
"North Asia Standard Time",
"China Standard Time",
"Singapore Standard Time",
"Taipei Standard Time",
"W. Australia Standard Time",
"North Asia East Standard Time",
"Korea Standard Time",
"Tokyo Standard Time",
"Yakutsk Standard Time",
"A.U.S. Central Standard Time",
"Cen. Australia Standard Time",
"A.U.S. Eastern Standard Time",
"E. Australia Standard Time",
"Tasmania Standard Time",
"Vladivostok Standard Time",
"West Pacific Standard Time",
"Central Pacific Standard Time",
"Fiji Islands Standard Time",
"New Zealand Standard Time",
"Tonga Standard Time"
]
},
"scaleUpScheduleStartTime": {
"type": "String",
"metadata": {
"description": "The beginning of the time period during which the data warehouse can only be scaled up."
},
"allowedValues": [
"12:00 AM ( 0:00 )",
"12:30 AM ( 0:30 )",
"01:00 AM ( 1:00 )",
"01:30 AM ( 1:30 )",
"02:00 AM ( 2:00 )",
"02:30 AM ( 2:30 )",
"03:00 AM ( 3:00 )",
"03:30 AM ( 3:30 )",
"04:00 AM ( 4:00 )",
"04:30 AM ( 4:30 )",
"05:00 AM ( 5:00 )",
"05:30 AM ( 5:30 )",
"06:00 AM ( 6:00 )",
"06:30 AM ( 6:30 )",
"07:00 AM ( 7:00 )",
"07:30 AM ( 7:30 )",
"08:00 AM ( 8:00 )",
"08:30 AM ( 8:30 )",
"09:00 AM ( 9:00 )",
"09:30 AM ( 9:30 )",
"10:00 AM ( 10:00 )",
"10:30 AM ( 10:30 )",
"11:00 AM ( 11:00 )",
"11:30 AM ( 11:30 )",
"12:00 PM ( 12:00 )",
"12:30 PM ( 12:30 )",
"01:00 PM ( 13:00 )",
"01:30 PM ( 13:30 )",
"02:00 PM ( 14:00 )",
"02:30 PM ( 14:30 )",
"03:00 PM ( 15:00 )",
"03:30 PM ( 15:30 )",
"04:00 PM ( 16:00 )",
"04:30 PM ( 16:30 )",
"05:00 PM ( 17:00 )",
"05:30 PM ( 17:30 )",
"06:00 PM ( 18:00 )",
"06:30 PM ( 18:30 )",
"07:00 PM ( 19:00 )",
"07:30 PM ( 19:30 )",
"08:00 PM ( 20:00 )",
"08:30 PM ( 20:30 )",
"09:00 PM ( 21:00 )",
"09:30 PM ( 21:30 )",
"10:00 PM ( 22:00 )",
"10:30 PM ( 22:30 )",
"11:00 PM ( 23:00 )",
"11:30 PM ( 23:30 )"
]
},
"scaleUpScheduleEndTime": {
"type": "String",
"metadata": {
"description": "The end of the time period during which the data warehouse can only be scaled up."
},
"allowedValues": [
"12:00 AM ( 0:00 )",
"12:30 AM ( 0:30 )",
"01:00 AM ( 1:00 )",
"01:30 AM ( 1:30 )",
"02:00 AM ( 2:00 )",
"02:30 AM ( 2:30 )",
"03:00 AM ( 3:00 )",
"03:30 AM ( 3:30 )",
"04:00 AM ( 4:00 )",
"04:30 AM ( 4:30 )",
"05:00 AM ( 5:00 )",
"05:30 AM ( 5:30 )",
"06:00 AM ( 6:00 )",
"06:30 AM ( 6:30 )",
"07:00 AM ( 7:00 )",
"07:30 AM ( 7:30 )",
"08:00 AM ( 8:00 )",
"08:30 AM ( 8:30 )",
"09:00 AM ( 9:00 )",
"09:30 AM ( 9:30 )",
"10:00 AM ( 10:00 )",
"10:30 AM ( 10:30 )",
"11:00 AM ( 11:00 )",
"11:30 AM ( 11:30 )",
"12:00 PM ( 12:00 )",
"12:30 PM ( 12:30 )",
"01:00 PM ( 13:00 )",
"01:30 PM ( 13:30 )",
"02:00 PM ( 14:00 )",
"02:30 PM ( 14:30 )",
"03:00 PM ( 15:00 )",
"03:30 PM ( 15:30 )",
"04:00 PM ( 16:00 )",
"04:30 PM ( 16:30 )",
"05:00 PM ( 17:00 )",
"05:30 PM ( 17:30 )",
"06:00 PM ( 18:00 )",
"06:30 PM ( 18:30 )",
"07:00 PM ( 19:00 )",
"07:30 PM ( 19:30 )",
"08:00 PM ( 20:00 )",
"08:30 PM ( 20:30 )",
"09:00 PM ( 21:00 )",
"09:30 PM ( 21:30 )",
"10:00 PM ( 22:00 )",
"10:30 PM ( 22:30 )",
"11:00 PM ( 23:00 )",
"11:30 PM ( 23:30 )"
]
}
},
"variables": {
"functionName": "ScaleSqlDw",
"functionAppName": "[concat(uniquestring(resourceGroup().id), 'funcapp')]",
"hostingPlanName": "[concat(uniquestring(resourceGroup().id), 'appserv')]",
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'funcstore')]",
"storageAccountid": "[concat(resourceGroup().id,'/providers/','Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
"sqlDwId": "[resourceId(parameters('SQL DW Resource Group'),'Microsoft.Sql/servers/databases', parameters('SQL DW Logical Server'), parameters('SQL DW Name'))]",
"codePackageLocation": "https://github.com/Microsoft/sql-data-warehouse-samples/blob/master/arm-templates/sqlDwAutoScaler/SqlDwAutoScaler.zip?raw=true",
"scaleUpScheduleStartTimeMinute": "[replace(split(substring(parameters('scaleUpScheduleStartTime'), 11, 5), ':')[1],'00', '0')]",
"scaleUpScheduleStartTimeHour": "[split(substring(parameters('scaleUpScheduleStartTime'), 11, 5), ':')[0]]",
"scaleUpScheduleEndTimeMinute": "[replace(split(substring(parameters('scaleUpScheduleEndTime'), 11, 5), ':')[1], '00', '0')]",
"scaleUpScheduleEndTimeHour": "[split(substring(parameters('scaleUpScheduleEndTime'), 11, 5), ':')[0]]",
"scaleUpScheduleStartTime": "[concat(variables('scaleUpScheduleStartTimeHour'), ':' , variables('scaleUpScheduleStartTimeMinute'))]",
"scaleUpScheduleEndTime": "[concat(variables('scaleUpScheduleEndTimeHour'), ':' , variables('scaleUpScheduleEndTimeMinute'))]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"sku": {
"name": "[parameters('Storage Account Type')]"
},
"kind": "Storage",
"name": "[variables('storageAccountName')]",
"apiVersion": "2016-12-01",
"location": "[resourceGroup().location]"
},
{
"type": "Microsoft.Web/serverfarms",
"name": "[variables('hostingPlanName')]",
"apiVersion": "2015-04-01",
"location": "[resourceGroup().location]",
"properties": {
"name": "[variables('hostingPlanName')]",
"computeMode": "Dynamic",
"sku": "Dynamic"
}
},
{
"type": "Microsoft.Web/sites",
"kind": "functionapp",
"name": "[variables('functionAppName')]",
"apiVersion": "2015-08-01",
"location": "[resourceGroup().location]",
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
"siteConfig": {
"appSettings": [{
"name": "AzureWebJobsDashboard",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[variables('storageAccountName')]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~1"
},
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "6.5.0"
},
{
"name": "WEBSITE_TIME_ZONE",
"value": "[parameters('WEBSITE_TIME_ZONE')]"
},
{
"name": "SqlDwLocation",
"value": "[parameters('SQL DW Region')]"
},
{
"name": "DwuConfigFile",
"value": "D:\\home\\site\\wwwroot\\dwuconfigs.json"
},
{
"name": "DwScaleLogsTable",
"value": "DwScaleLogs"
},
{
"name": "ScaleUpScheduleStartTime",
"value": "[variables('scaleUpScheduleStartTime')]"
},
{
"name": "ScaleUpScheduleEndTime",
"value": "[variables('scaleUpScheduleEndTime')]"
},
{
"name": "SubscriptionId",
"value": "[parameters('Subscription ID')]"
},
{
"name": "TenantId",
"value": "[parameters('Azure Active Directory ID')]"
},
{
"name": "ClientId",
"value": "[parameters('Service Principal Application ID')]"
},
{
"name": "ClientKey",
"value": "[parameters('Service Principal Secret Key')]"
}
]
}
},
"resources": [{
"type": "extensions",
"name": "MSDeploy",
"apiVersion": "2015-08-01",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "webdeploy"
},
"properties": {
"packageUri": "[variables('codePackageLocation')]",
"dbType": "None",
"connectionString": "",
"description": "Deployment of the Autoscaler functions."
},
"dependsOn": [
"[concat('Microsoft.Web/sites/', variables('functionAppName'))]"
],
"resources": [{
"apiVersion": "2017-05-10",
"name": "alertTemplate",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "incremental",
"templateLink": {
"uri": "https://raw.githubusercontent.com/Microsoft/sql-data-warehouse-samples/master/arm-templates/sqlDwAutoScaler/alert-template.json",
"contentVersion": "1.0.0.0"
},
"parameters": {
"sqlDwId": {
"value": "[variables('sqlDwId')]"
},
"functionAppName": {
"value": "[variables('functionAppName')]"
},
"functionName": {
"value": "[variables('functionName')]"
}
}
},
"dependsOn": [
"MSDeploy"
]
}]
}],
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
]
}
]
}