forked from sonicwall/sonicwall-nsv-azure-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainTemplate.json
575 lines (575 loc) · 18.2 KB
/
mainTemplate.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
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().Location]",
"metadata": {
"description": "Geo-Location to deploy SonicWall NSv"
}
},
"storageAccount": {
"type": "string",
"metadata": {
"description": "Globally unique lowercase name of your storage account"
}
},
"storageAccountType": {
"type": "string",
"metadata": {
"description": "The type of the Storage Account created"
},
"defaultValue": "Standard_LRS"
},
"storageAccountNewOrExisting": {
"type": "string",
"defaultValue": "new",
"allowedValues": [
"new",
"existing"
],
"metadata": {
"Description": "Indicates whether the Storage Account is new or existing"
}
},
"existingStorageAccountRG": {
"type": "string",
"defaultValue": "[resourceGroup().Name]",
"metadata": {
"description": "Storage Resource Group of the Existing VM."
}
},
"vmName": {
"type": "string",
"defaultValue": "new",
"metadata": {
"description": "Name of SonicWall-NSv VM in the Azure portal"
}
},
"SSHUserName": {
"type": "string",
"defaultValue": "management",
"metadata": {
"description": "Username for SSH access to SonicWall-NSv console"
}
},
"authenticationType": {
"type": "string",
"metadata": {
"descritpion": "Type of authentication "
},
"allowedValues": [
"sshPublicKey",
"password"
],
"defaultValue": "password"
},
"SSHPassword": {
"type": "securestring",
"metadata": {
"description": "The password for the above SSH user. Password must contain one non alpha-numeric character, one uppercase alpha-numeric character and one numeric character"
}
},
"sshKey": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "SSH rsa public key file as a string."
}
},
"imageSku": {
"type": "string",
"defaultValue": "snwl-nsv-scx",
"metadata": {
"description": "The name of the Azure product to load"
}
},
"imageVersion": {
"type": "string",
"defaultValue": "latest",
"metadata": {
"description": "The version of loaded NSv image"
}
},
"managementAccessIPSource": {
"type": "string",
"metadata": {
"description": "Public IP address allowed access SonicWall NSv HTTPS & SSH management "
}
},
"nsvModel": {
"type": "string",
"allowedValues": [
"NSv 270",
"NSv 470",
"NSv 870"
],
"metadata": {
"description": "SonicWall-NSv model, NSv 270 VM size Standard_DS2_v2 or Standard_D2_v2, NSv 470 VM size Standard_DS3_v2 or Standard_D3_v2, NSv 870 VM size Standard_DS4_v2 or Standard_D4_v2, depending on the SKU selected"
},
"defaultValue": "NSv 470"
},
"virtualNetworkNewOrExisting": {
"type": "string",
"defaultValue": "new",
"metadata": {
"description": "Determines whether or not a new virtual network should be provisioned."
}
},
"virtualNetworkName": {
"type": "string",
"metadata": {
"description": "Name of the virtual network that the consumer wants to use"
},
"defaultValue": "firewallVnet"
},
"virtualNetworkAddressPrefix": {
"type": "array",
"defaultValue": [
"192.168.0.0/16"
],
"metadata": {
"description": "Virtual network address CIDR"
}
},
"virtualNetworkResourceGroupName": {
"type": "string",
"defaultValue": "[resourceGroup().name]",
"metadata": {
"description": "Name of the resource group for the existing virtual network"
}
},
"subnetWANName": {
"type": "string",
"defaultValue": "WAN-X1",
"metadata": {
"description": "Subnet for the WAN (X1)"
}
},
"subnetLANName": {
"type": "string",
"defaultValue": "LAN-X0",
"metadata": {
"description": "Subnet for the LAN (X0)"
}
},
"subnetWANPrefix": {
"type": "string",
"defaultValue": "192.168.1.0/24",
"metadata": {
"description": "WAN (X1) subnet CIDR"
}
},
"subnetLANPrefix": {
"type": "string",
"defaultValue": "192.168.2.0/24",
"metadata": {
"description": "LAN (X0) subnet CIDR"
}
},
"publicIpNewOrExisting": {
"type": "string",
"defaultValue": "new",
"metadata": {
"description": "Determines whether or not a new public ip should be provisioned."
}
},
"publicIpName": {
"type": "string",
"defaultValue": "PublicIp",
"metadata": {
"description": "Name of the public ip address"
}
},
"publicIpDns": {
"type": "string",
"defaultValue": "[concat('sonicwall-nsv-', uniqueString(resourceGroup().id))]",
"metadata": {
"description": "DNS of the public ip address for the VM"
}
},
"publicIpResourceGroupName": {
"type": "string",
"defaultValue": "[resourceGroup().name]",
"metadata": {
"description": "Name of the resource group for the public ip address"
}
},
"publicIpAllocationMethod": {
"type": "string",
"defaultValue": "Dynamic",
"allowedValues": [
"Dynamic",
"Static"
],
"metadata": {
"description": "Allocation method for the public ip address"
}
},
"publicIpSku": {
"type": "string",
"defaultValue": "Basic",
"allowedValues": [
"Basic",
"Standard"
],
"metadata": {
"description": "Name of the resource group for the public ip address"
}
}
},
"variables": {
"sshPublicKeyOsProfile": {
"computerName": "[parameters('vmName')]",
"adminUserName": "[parameters('SSHUserName')]",
"linuxConfiguration": {
"disablePasswordAuthentication": "true",
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', parameters('SSHUserName'), '/.ssh/authorized_keys')]",
"keyData": "[parameters('sshKey')]"
}
]
}
}
},
"passwordOsProfile": {
"computerName": "[parameters('vmName')]",
"adminUserName": "[parameters('SSHUserName')]",
"adminPassword": "[parameters('SSHPassword')]"
},
"trustedLaunchSecurityProfile": {
"securityType": "TrustedLaunch",
"uefiSettings": {
"secureBootEnabled": false,
"vTpmEnabled": true
}
},
"vmSize": {
"NSv 270": "[if(sonicwall.isLegacySku(parameters('imageSku')), 'Standard_D2_v2', 'Standard_DS2_v2')]",
"NSv 470": "[if(sonicwall.isLegacySku(parameters('imageSku')), 'Standard_D3_v2', 'Standard_DS3_v2')]",
"NSv 870": "[if(sonicwall.isLegacySku(parameters('imageSku')), 'Standard_D4_v2', 'Standard_DS4_v2')]"
},
"imagePublisher": "sonicwall-inc",
"imageOffer" : "sonicwall-nsz-azure",
"imageVersionNumberPrefix": "[if(equals(indexOf(parameters('imageVersion'), '.'), -1), '0.0.', '')]",
"imageVersionNumber": "[concat(variables('imageVersionNumberPrefix'), parameters('imageVersion'))]",
"imageVersion": "[if(equals(parameters('imageVersion'), 'latest'), 'latest', variables('imageVersionNumber'))]",
"nicName": "[concat(parameters('vmName'), '-interface')]",
"publicIPAddressType": "Dynamic",
"nsgname-mgmt": "[concat(parameters('vmName'), '-NSG')]",
"publicIpAddressId": {
"id": "[resourceId(parameters('publicIpResourceGroupName'), 'Microsoft.Network/publicIPAddresses', parameters('publicIpName'))]"
}
},
"functions": [
{
"namespace": "sonicwall",
"members": {
"isLegacySku": {
"parameters": [
{
"name": "sku",
"type": "string"
}
],
"output": {
"type": "bool",
"value": "[contains(createArray('snwl-nsv-654-beta-r', 'snwl-nsv-beta-i', 'snwl-nsv-beta-p', 'snwl-nsv-beta-q', 'snwl-nsv-byol', 'snwl-nsv-byol-654', 'snwl-nsv-byol-v4'), toLower(parameters('sku')))]"
}
}
}
}
],
"resources": [
{
"condition": "[equals(parameters('storageAccountNewOrExisting'), 'new')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2018-02-01",
"name": "[parameters('storageAccount')]",
"location": "[parameters('location')]",
"kind": "Storage",
"sku": {
"name": "[parameters('storageAccountType')]"
}
},
{
"condition": "[equals(parameters('publicIpNewOrExisting'), 'new')]",
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2018-04-01",
"name": "[parameters('publicIpName')]",
"location": "[parameters('location')]",
"sku": {
"name": "[parameters('publicIpSku')]"
},
"properties": {
"publicIPAllocationMethod": "[parameters('publicIpAllocationMethod')]",
"dnsSettings": {
"domainNameLabel": "[parameters('publicIpDns')]"
}
}
},
{
"condition": "[equals(parameters('virtualNetworkNewOrExisting'), 'new')]",
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2018-04-01",
"name": "[parameters('virtualNetworkName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgname-mgmt'))]"
],
"properties": {
"addressSpace": {
"addressPrefixes": "[parameters('virtualNetworkAddressPrefix')]"
},
"subnets": [
{
"name": "[parameters('subnetWANName')]",
"properties": {
"addressPrefix": "[parameters('subnetWANPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgname-mgmt'))]"
}
}
},
{
"name": "[parameters('subnetLANName')]",
"properties": {
"addressPrefix": "[parameters('subnetLANPrefix')]"
}
}
]
}
},
{
"apiVersion": "2018-04-01",
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[concat(parameters('vmName'), '-NSG')]",
"location": "[parameters('location')]",
"properties": {
"securityRules": [
{
"name": "Allow-HTTPS-management-from-IP",
"properties": {
"description": "Allow management from CIDR",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "443",
"sourceAddressPrefix": "[parameters('managementAccessIPSource')]",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound"
}
},
{
"name": "Allow-SSH-management-from-IP",
"properties": {
"description": "Allow management from CIDR",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "[parameters('managementAccessIPSource')]",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 101,
"direction": "Inbound"
}
},
{
"name": "Allow-HTTP-management-from-IP",
"properties": {
"description": "Allow management from CIDR",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "80",
"sourceAddressPrefix": "[parameters('managementAccessIPSource')]",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 102,
"direction": "Inbound"
}
},
{
"name": "Allow-AzureLoadBalancer",
"properties": {
"description": "Allow AzureLoadBalancer",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "168.63.129.16",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 103,
"direction": "Inbound"
}
},
{
"name": "Deny-HTTPS-management",
"properties": {
"description": "Deny HTTPS",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "443",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Deny",
"priority": 200,
"direction": "Inbound"
}
},
{
"name": "Deny-SSH-management",
"properties": {
"description": "Deny SSH",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Deny",
"priority": 201,
"direction": "Inbound"
}
},
{
"name": "Deny-HTTP-management",
"properties": {
"description": "Deny HTTP",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "80",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Deny",
"priority": 202,
"direction": "Inbound"
}
},
{
"name": "Default-Allow",
"properties": {
"description": "Allow all other traffic so firewall can do its job",
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 300,
"direction": "Inbound"
}
}
]
}
},
{
"apiVersion": "2018-04-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat(variables('nicName'), '-X1')]",
"location": "[parameters('location')]",
"dependsOn": [
"[parameters('publicIpName')]",
"[parameters('virtualNetworkName')]",
"[variables('nsgname-mgmt')]"
],
"tags": {
"displayName": "[concat('NetworkInterfaces', '-X1')]"
},
"properties": {
"enableIPForwarding": true,
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgname-mgmt'))]"
},
"ipConfigurations": [
{
"name": "[concat('ipconfig', '1')]",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": "[if(not(equals(parameters('publicIpNewOrExisting'), 'none')), variables('publicIpAddressId') , json('null'))]",
"subnet": {
"id": "[resourceId(parameters('virtualNetworkResourceGroupName'), 'Microsoft.Network/virtualNetworks/subnets/', parameters('virtualNetworkName'), parameters('subnetWANName'))]"
}
}
}
]
}
},
{
"apiVersion": "2018-04-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat(variables('nicName'), '-X0')]",
"location": "[parameters('location')]",
"dependsOn": [
"[parameters('virtualNetworkName')]"
],
"tags": {
"displayName": "[concat('NetworkInterfaces', '-X0')]"
},
"properties": {
"enableIPForwarding": true,
"ipConfigurations": [
{
"name": "[concat('ipconfig', '2')]",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[resourceId(parameters('virtualNetworkResourceGroupName'), 'Microsoft.Network/virtualNetworks/subnets/', parameters('virtualNetworkName'), parameters('subnetLANName'))]"
}
}
}
]
}
},
{
"apiVersion": "2020-12-01",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('vmName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat(variables('nicName'),'-X1')]",
"[concat(variables('nicName'),'-X0')]"
],
"plan": {
"name": "[parameters('imageSku')]",
"product": "[variables('imageOffer')]",
"publisher": "[variables('imagePublisher')]"
},
"properties": {
"hardwareProfile": {
"vmSize": "[variables('vmSize')[parameters('nsvModel')]]"
},
"osProfile": "[variables(concat(parameters('authenticationType'), 'OsProfile'))]",
"securityProfile": "[if(sonicwall.isLegacySku(parameters('imageSku')), json('null'), variables('trustedLaunchSecurityProfile'))]",
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[parameters('imageSku')]",
"version": "[variables('imageVersion')]"
},
"osDisk": {
"caching": "ReadWrite",
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'),'-X1'))]",
"properties": {
"primary": true
}
}, {
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'),'-X0'))]",
"properties": {
"primary": false
}
}]
}
}
}
]
}