forked from erjosito/azure-networking-lab
-
Notifications
You must be signed in to change notification settings - Fork 1
/
NetworkingLab_master.json
352 lines (352 loc) · 14.1 KB
/
NetworkingLab_master.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
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"defaultValue": "lab-user",
"type": "string",
"metadata": { "description": "Default username for VMs and NVAs" }
},
"adminPassword": {
"defaultValue": null,
"type": "securestring",
"metadata": { "description": "Default password for VMs and NVAs" }
},
"createNVA": {
"defaultValue": "yes",
"type": "string",
"allowedValues": [ "yes","no" ],
"metadata": { "description": "Whether NVAs should be deployed at all or not" }
},
"nvaType": {
"defaultValue": "ubuntu",
"type": "string",
"allowedValues": [ "ubuntu","ubuntuScaleSet" ],
"metadata": { "description": "Choose ubuntuScaleSet to deploy NVA in a scale set" }
},
"createUDR": {
"defaultValue": "no",
"type": "string",
"allowedValues": [ "yes","no" ],
"metadata": { "description": "Whether UDRs should be configured (lab solution)" }
},
"createVPNgw": {
"defaultValue": "no",
"type": "string",
"allowedValues": [ "yes","no" ],
"metadata": { "description": "Whether VPN gateways should be deployed at all or not" }
},
"lbSku": {
"defaultValue": "standard",
"type": "string",
"allowedValues": [ "basic","standard" ],
"metadata": { "description": "Whether Load Balancers should be Basic or Standard" }
},
"vmSize": {
"defaultValue": "Standard_B1s",
"type": "string",
"metadata": { "description": "Size with which VMs (not the NVAs) will be created. Might be useful to modify if hitting quota limits" }
},
"location2ary": {
"defaultValue": "westus2",
"type": "string",
"metadata": { "description": "Secondary location for some of the subnets" }
},
"location2aryVnets": {
"defaultValue": [],
"type": "array",
"metadata": { "description": "Array with Vnets to be deployed in the 2ary location" }
}
},
"variables": {
"deploymentApiVersion": "2018-05-01",
"networkApiVersion": "2018-08-01",
"linuxVmTemplateURI": "[uri(deployment().properties.templateLink.uri, 'linuxVM.json')]",
"storageAccountName": "[concat('storage', uniqueString(resourceGroup().id))]",
"multiVnetParams": {
"storageAccountName": { "value": "[variables('storageAccountName')]" },
"vnetCount": { "value": 5 },
"createGw": { "value": "no" },
"enableBgp": { "value": "true" },
"createVm": { "value": "yes" },
"vmType": { "value": "ubuntu" },
"vmSize": { "value": "[parameters('vmSize')]" },
"createPip": { "value": "no" },
"adminUsername": { "value": "[parameters('adminUsername')]" },
"adminPassword": { "value": "[parameters('adminPassword')]" },
"location2ary": { "value": "[parameters('location2ary')]" },
"location2aryVnets": { "value": "[parameters('location2aryVnets')]" }
},
"multiVnetTemplateUri": "[uri(deployment().properties.templateLink.uri, 'multiVnetLab.json')]",
"customScriptHash": {
"ubuntu": "linuxNVAconfig.sh",
"ubuntuScaleSet": "linuxNVAconfig-1nic.sh"
},
"customScript": "[variables('customScriptHash')[parameters('nvaType')]]",
"customScriptUri": "[uri(deployment().properties.templateLink.uri, variables('customScript'))]",
"customScriptCmd": "[concat('chmod 666 ', variables('customScript'), ' && /bin/sh ./', variables('customScript'))]",
"nvaParams": {
"vmType": { "value": "ubuntu" },
"vmCount": { "value": 2 },
"vmName": { "value": "linuxnva" },
"vnetName": { "value": "myVnet4" },
"storageAccountName": { "value": "[variables('storageAccountName')]" },
"subnet0Name": { "value": "myVnet4subnet2" },
"subnet1Name": { "value": "myVnet4subnet3" },
"pipName": { "value": "nvaPip" },
"vmUsr": { "value": "[parameters('adminUsername')]" },
"vmPwd": { "value": "[parameters('adminPassword')]" },
"ip0": { "value": "10.4.2.10" },
"ip1": { "value": "10.4.3.10" },
"deployLBYesNo": { "value": "yes" },
"lbSku": { "value": "[parameters('lbSku')]" },
"scriptUri": { "value": "[variables('customScriptUri')]" },
"scriptCmd": { "value": "[variables('customScriptCmd')]" }
},
"nvaParamsYesNo": {
"yes": "[variables('nvaParams')]",
"no": {}
},
"NVATemplateUri": {
"csr": "[uri(deployment().properties.templateLink.uri, 'nva_2nic_noVnet.json')]",
"asa": "[uri(deployment().properties.templateLink.uri, 'nva_2nic_noVnet.json')]",
"ubuntu": "[uri(deployment().properties.templateLink.uri, 'nvaLinux_2nic_noVnet.json')]",
"ubuntuScaleSet": "[uri(deployment().properties.templateLink.uri, 'nvaLinux_1nic_noVnet_ScaleSet.json')]"
},
"NVATemplateUriYesNo": {
"yes": "[variables('NVATemplateUri')[parameters('nvaType')]]",
"no": "[uri(deployment().properties.templateLink.uri, 'nothing.json')]"
},
"vpnGwTemplateUriHash": {
"yes": "[uri(deployment().properties.templateLink.uri, 'vpnGw.json')]",
"no": "[uri(deployment().properties.templateLink.uri, 'nothing.json')]"
},
"vpnGwTemplateUri": "[variables('vpnGwTemplateUriHash')[parameters('createVPNgw')]]",
"vpnGwTemplateParamsHash1": {
"yes": {
"vnetName": { "value": "myVnet4" },
"gwName": { "value": "vnet4gw" },
"enableBgp": { "value": "true" },
"PIPName": { "value": "vnet4gwPip" }
},
"no": {}
},
"vpnGwTemplateParams1": "[variables('vpnGwTemplateParamsHash1')[parameters('createVPNgw')]]",
"vpnGwTemplateParamsHash2": {
"yes": {
"vnetName": { "value": "myVnet5" },
"gwName": { "value": "vnet5gw" },
"enableBgp": { "value": "true" },
"PIPName": { "value": "vnet5gwPip" }
},
"no": {}
},
"vpnGwTemplateParams2": "[variables('vpnGwTemplateParamsHash2')[parameters('createVPNgw')]]",
"PeeringUseRemoteGatewaysHash": {
"yes": true,
"no": false
},
"PeeringUseRemoteGateways": "[variables('PeeringUseRemoteGatewaysHash')[parameters('createVPNgw')]]",
"UDRTemplateUriYesNo": {
"yes": "[uri(deployment().properties.templateLink.uri, 'UDR_Lab.json')]",
"no": "[uri(deployment().properties.templateLink.uri, 'nothing.json')]"
},
"UDRTemplateUri": "[variables('UDRTemplateUriYesNo')[parameters('createUDR')]]"
},
"resources": [
{
"comments": "Create vnets, each with a gateway subnet, 3 standard subnets, and a Linux VM in subnet 1",
"name": "vnets",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('deploymentApiVersion')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('multiVnetTemplateUri')]",
"contentVersion": "1.0.0.0"
},
"parameters": "[variables('multiVnetParams')]"
}
},
{
"comments": "Create additional VM in Vnet1-Subnet1",
"name": "vnet1subnet1vm2",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('deploymentApiVersion')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('linuxVmTemplateURI')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"adminUsername": {"value": "[parameters('adminUsername')]"},
"adminPassword": {"value": "[parameters('adminPassword')]"},
"vmName": { "value": "myVnet1-vm2" },
"vmType": {"value": "ubuntu"},
"vmSize": { "value": "[parameters('vmSize')]" },
"vnetName": { "value": "myVnet1" },
"subnetName": { "value": "myVnet1Subnet1" },
"storageAccountName": { "value": "[variables('storageAccountName')]"}
}
},
"dependsOn": [
"vnets"
]
},
{
"comments": "Create NVAs in vnet4, if createNVA=yes",
"name": "nva",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('deploymentApiVersion')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('NVATemplateUriYesNo')[parameters('createNVA')]]",
"contentVersion": "1.0.0.0"
},
"parameters": "[variables('nvaParamsYesNo')[parameters('createNVA')]]"
},
"dependsOn": [
"vnets"
]
},
{
"comments": "create vnet peering between hub (vnet4) and vnet1",
"name": "hub2spoke1",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('deploymentApiVersion')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[uri(deployment().properties.templateLink.uri, 'vnetPeeringHubNSpoke.json')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"hubVnetName": { "value": "myVnet4" },
"spokeVnetName": { "value": "myVnet1" },
"useRemoteGateways": { "value": "[variables('PeeringUseRemoteGateways')]" }
}
},
"dependsOn": [
"vnets", "vnet4Gw"
]
},
{
"comments": "create vnet peering between hub (vnet4) and vnet2",
"name": "hub2spoke2",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('deploymentApiVersion')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[uri(deployment().properties.templateLink.uri, 'vnetPeeringHubNSpoke.json')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"hubVnetName": { "value": "myVnet4" },
"spokeVnetName": { "value": "myVnet2" },
"useRemoteGateways": { "value": "[variables('PeeringUseRemoteGateways')]" }
}
},
"dependsOn": [
"vnets", "vnet4Gw"
]
},
{
"comments": "create vnet peering between hub (vnet4) and spolke(vnet3)",
"name": "hub2spoke3",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('deploymentApiVersion')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[uri(deployment().properties.templateLink.uri, 'vnetPeeringHubNSpoke.json')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"hubVnetName": { "value": "myVnet4" },
"spokeVnetName": { "value": "myVnet3" },
"useRemoteGateways": { "value": "[variables('PeeringUseRemoteGateways')]" }
}
},
"dependsOn": [
"vnets", "vnet4Gw"
]
},
{
"comments": "Create public IP address for Vnet Gateway in Vnet4",
"apiVersion": "[variables('networkApiVersion')]",
"type": "Microsoft.Network/publicIPAddresses",
"name": "vnet4gwPip",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAllocationMethod": "Dynamic"
}
},
{
"comments": "Create public IP address for Vnet Gateway in Vnet5",
"apiVersion": "[variables('networkApiVersion')]",
"type": "Microsoft.Network/publicIPAddresses",
"name": "vnet5gwPip",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAllocationMethod": "Dynamic"
}
},
{
"comments": "Create VPN gateway in vnet4. I havent found how to create a standard SKU, it needs to be manually resized afterwards. The BGP ASN number must be changed so that it is different than the ASN of the GW in vnet5",
"name": "vnet4Gw",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('deploymentApiVersion')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('vpnGwTemplateUri')]",
"contentVersion": "1.0.0.0"
},
"parameters": "[variables('vpnGwTemplateParams1')]"
},
"dependsOn": [
"vnet4gwPip",
"vnets"
]
},
{
"comments": "Create VPN gateway in vnet5. I havent found how to create a standard SKU, it needs to be manually resized afterwards. The BGP ASN number must be changed so that it is different than the ASN of the GW in vnet4",
"name": "vnet5Gw",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('deploymentApiVersion')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('vpnGwTemplateUri')]",
"contentVersion": "1.0.0.0"
},
"parameters": "[variables('vpnGwTemplateParams2')]"
},
"dependsOn": [
"vnet5gwPip",
"vnets"
]
},
{
"comments": "Deploy optionally UDRs",
"name": "UDRs",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('deploymentApiVersion')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('UDRTemplateUri')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
}
},
"dependsOn": [
"vnets"
]
}
]
}