dns-unbound/azuredeploy.json

raw link view readme
1 {
2 "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3 "contentVersion": "1.0.0.0",
4 "parameters": {
5 "admin-username": {
6 "type": "string"
7 },
8 "ssh-public-key": {
9 "type": "string"
10 }
11 },
12 "variables": {
13 "ssh-keypath": "[concat('/home/', parameters('admin-username'), '/.ssh/authorized_keys')]",
14 "unique-prefix": "[concat(replace(resourceGroup().name,'-',''), substring(uniquestring(resourceGroup().name), 0, 5))]",
15 "storage-name": "[variables('unique-prefix')]",
16 "vnet-name": "[concat(resourceGroup().name, '-vnet')]",
17 "ip-prefix": "[concat(resourceGroup().name, '-ip-')]",
18 "nsg-prefix": "[concat(resourceGroup().name, '-nsg')]",
19 "nic-prefix": "[concat(resourceGroup().name, '-nic-')]",
20 "access-nic-internal": "[concat(resourceGroup().name, '-access-nic-internal')]",
21 "access-nic-external": "[concat(resourceGroup().name, '-access-nic-external')]",
22 "vm-prefix": "[concat(resourceGroup().name, '-vm-')]",
23 "names": [ "alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta", "iota", "kappa", "lambda", "mu", "nu", "xi", "omicron", "pi", "rho", "sigma", "tau", "upsilon", "phi", "chi", "psi", "omega" ],
24 "private-vm-size": "Standard_DS1_v2",
25 "vnet-address-space": "10.16.0.0/12",
26 "vnet-subnet01-octet": 17,
27 "vnet-subnet02-octet": 18
28 },
29 "resources": [
30 {
31 "comments": "",
32 "type": "Microsoft.Network/publicIPAddresses",
33 "name": "[concat(variables('ip-prefix'), variables('names')[0])]",
34 "apiVersion": "2017-03-01",
35 "location": "[resourceGroup().location]",
36 "properties": {
37 "publicIPAllocationMethod": "Dynamic",
38 "idleTimeoutInMinutes": 4,
39 "dnsSettings": {
40 "domainNameLabel": "[concat(variables('unique-prefix'), '-', variables('names')[0])]"
41 }
42 },
43 "resources": [],
44 "dependsOn": []
45 },
46 {
47 "comments": "",
48 "type": "Microsoft.Compute/virtualMachines",
49 "name": "[concat(variables('vm-prefix'), variables('names')[0])]",
50 "apiVersion": "2016-04-30-preview",
51 "location": "[resourceGroup().location]",
52 "properties": {
53 "hardwareProfile": {
54 "vmSize": "Standard_DS2_v2"
55 },
56 "storageProfile": {
57 "imageReference": {
58 "publisher": "OpenLogic",
59 "offer": "CentOS",
60 "sku": "7.2",
61 "version": "latest"
62 },
63 "osDisk": {
64 "name": "[concat(variables('vm-prefix'), variables('names')[0], '-boot')]",
65 "createOption": "FromImage",
66 "vhd": {
67 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[0], '-boot.vhd')]"
68 },
69 "caching": "ReadWrite"
70 },
71 "dataDisks": [
72 {
73 "name": "[concat(variables('vm-prefix'), variables('names')[0], '-disk01')]",
74 "diskSizeGB": 127,
75 "lun": 0,
76 "vhd": {
77 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[0], '-data01.vhd')]"
78 },
79 "createOption": "Empty"
80 }
81 ]
82 },
83 "osProfile": {
84 "computerName": "[concat(variables('vm-prefix'), variables('names')[0])]",
85 "adminUsername": "[parameters('admin-username')]",
86 "linuxConfiguration": {
87 "disablePasswordAuthentication": true,
88 "ssh": {
89 "publicKeys": [
90 {
91 "path": "[variables('ssh-keypath')]",
92 "keyData": "[parameters('ssh-public-key')]"
93 }
94 ]
95 }
96 }
97 },
98 "networkProfile": {
99 "networkInterfaces": [
100 {
101 "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0]))]",
102 "properties": { "primary": true }
103 },
104 {
105 "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('vm-prefix'), variables('names')[0], '-', variables('names')[1]))]",
106 "properties": { "primary": false }
107 }
108 ]
109 }
110 },
111 "resources": [],
112 "dependsOn": [
113 "[resourceId('Microsoft.Storage/storageAccounts', variables('storage-name'))]",
114 "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0]))]",
115 "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('vm-prefix'), variables('names')[0], '-', variables('names')[1]))]"
116 ]
117 },
118 {
119 "comments": "",
120 "type": "Microsoft.Compute/virtualMachines",
121 "name": "[concat(variables('vm-prefix'), variables('names')[1])]",
122 "apiVersion": "2016-04-30-preview",
123 "location": "[resourceGroup().location]",
124 "properties": {
125 "hardwareProfile": {
126 "vmSize": "[variables('private-vm-size')]"
127 },
128 "storageProfile": {
129 "imageReference": {
130 "publisher": "OpenLogic",
131 "offer": "CentOS",
132 "sku": "7.2",
133 "version": "latest"
134 },
135 "osDisk": {
136 "name": "[concat(concat(variables('vm-prefix'), variables('names')[1]), '-boot')]",
137 "createOption": "FromImage",
138 "vhd": {
139 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[1], '-boot.vhd')]"
140 },
141 "caching": "ReadWrite"
142 },
143 "dataDisks": [
144 {
145 "name": "[concat(variables('vm-prefix'), variables('names')[1], '-disk01')]",
146 "diskSizeGB": 127,
147 "lun": 0,
148 "vhd": {
149 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[1], '-data01.vhd')]"
150 },
151 "createOption": "Empty"
152 }
153 ]
154 },
155 "osProfile": {
156 "computerName": "[concat(variables('vm-prefix'), variables('names')[1])]",
157 "adminUsername": "[parameters('admin-username')]",
158 "linuxConfiguration": {
159 "disablePasswordAuthentication": true,
160 "ssh": {
161 "publicKeys": [
162 {
163 "path": "[variables('ssh-keypath')]",
164 "keyData": "[parameters('ssh-public-key')]"
165 }
166 ]
167 }
168 }
169 },
170 "networkProfile": {
171 "networkInterfaces": [
172 {
173 "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('vm-prefix'), variables('names')[1]))]"
174 }
175 ]
176 }
177 },
178 "resources": [],
179 "dependsOn": [
180 "[resourceId('Microsoft.Storage/storageAccounts', variables('storage-name'))]",
181 "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('vm-prefix'), variables('names')[1]))]"
182 ]
183 },
184 {
185 "comments": "",
186 "type": "Microsoft.Network/networkInterfaces",
187 "name": "[concat(variables('nic-prefix'), variables('names')[0])]",
188 "apiVersion": "2017-03-01",
189 "location": "[resourceGroup().location]",
190 "properties": {
191 "ipConfigurations": [
192 {
193 "name": "ifconfig1",
194 "properties": {
195 "publicIPAddress": {
196 "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[0]))]"
197 },
198 "subnet": {
199 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet01')]"
200 }
201 }
202 }
203 ],
204 "dnsSettings": {
205 "dnsServers": []
206 },
207 "enableIPForwarding": false,
208 "networkSecurityGroup": {
209 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
210 }
211 },
212 "resources": [],
213 "dependsOn": [
214 "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[0]))]",
215 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
216 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
217 ]
218 },
219 {
220 "comments": "",
221 "type": "Microsoft.Network/networkInterfaces",
222 "name": "[concat(variables('vm-prefix'), variables('names')[0], '-', variables('names')[1])]",
223 "apiVersion": "2017-03-01",
224 "location": "[resourceGroup().location]",
225 "properties": {
226 "ipConfigurations": [
227 {
228 "name": "ifconfig",
229 "properties": {
230 "privateIPAddress": "[concat('10.', variables('vnet-subnet02-octet'), '.0.5')]",
231 "privateIPAllocationMethod": "Static",
232 "subnet": {
233 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet02')]"
234 }
235 }
236 }
237 ],
238 "dnsSettings": {
239 "dnsServers": []
240 },
241 "enableIPForwarding": false,
242 "networkSecurityGroup": {
243 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
244 }
245 },
246 "resources": [],
247 "dependsOn": [
248 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
249 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
250 ]
251 },
252 {
253 "type": "Microsoft.Compute/virtualMachines/extensions",
254 "name": "[concat(variables('vm-prefix'), variables('names')[0], '/script')]",
255 "apiVersion": "2015-05-01-preview",
256 "location": "[resourceGroup().location]",
257 "dependsOn": [
258 "[concat(variables('vm-prefix'), variables('names')[0])]"
259 ],
260 "properties": {
261 "publisher": "Microsoft.Azure.Extensions",
262 "type": "CustomScript",
263 "typeHandlerVersion": "2.0",
264 "autoUpgradeMinorVersion": true,
265 "settings": {
266 "fileUris": [
267 "https://linux.azure.david.betz.space/raw/dns/service-install.sh"
268 ],
269 "commandToExecute": "sh install.sh"
270 }
271 }
272 },
273 {
274 "comments": "",
275 "type": "Microsoft.Network/networkInterfaces",
276 "name": "[concat(variables('vm-prefix'), variables('names')[1])]",
277 "apiVersion": "2017-03-01",
278 "location": "[resourceGroup().location]",
279 "properties": {
280 "ipConfigurations": [
281 {
282 "name": "ifconfig",
283 "properties": {
284 "privateIPAddress": "[concat('10.', variables('vnet-subnet02-octet'), '.0.6')]",
285 "privateIPAllocationMethod": "Static",
286 "subnet": {
287 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet02')]"
288 }
289 }
290 }
291 ],
292 "dnsSettings": {
293 "dnsServers": []
294 },
295 "enableIPForwarding": false,
296 "networkSecurityGroup": {
297 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[1]))]"
298 }
299 },
300 "resources": [],
301 "dependsOn": [
302 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
303 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[1]))]"
304 ]
305 },
306 {
307 "comments": "",
308 "type": "Microsoft.Network/virtualNetworks",
309 "name": "[variables('vnet-name')]",
310 "apiVersion": "2017-03-01",
311 "location": "[resourceGroup().location]",
312 "properties": {
313 "addressSpace": {
314 "addressPrefixes": [
315 "[variables('vnet-address-space')]"
316 ]
317 },
318 "subnets": [
319 {
320 "name": "subnet01",
321 "properties": {
322 "addressPrefix": "[concat('10.', variables('vnet-subnet01-octet'), '.0.0/16')]"
323 }
324 },
325 {
326 "name": "subnet02",
327 "properties": {
328 "addressPrefix": "[concat('10.', variables('vnet-subnet02-octet'), '.0.0/16')]"
329 }
330 }
331 ]
332 },
333 "resources": [],
334 "dependsOn": []
335 },
336 {
337 "comments": "",
338 "type": "Microsoft.Network/networkSecurityGroups",
339 "name": "[concat(variables('nsg-prefix'), variables('names')[0])]",
340 "apiVersion": "2017-03-01",
341 "location": "[resourceGroup().location]",
342 "properties": {
343 "securityRules": [
344 {
345 "name": "default-allow-ssh",
346 "properties": {
347 "protocol": "Tcp",
348 "sourcePortRange": "*",
349 "destinationPortRange": "22",
350 "sourceAddressPrefix": "*",
351 "destinationAddressPrefix": "*",
352 "access": "Allow",
353 "priority": 1000,
354 "direction": "Inbound"
355 }
356 },
357 {
358 "name": "http",
359 "properties": {
360 "protocol": "Tcp",
361 "sourcePortRange": "*",
362 "destinationPortRange": "80",
363 "sourceAddressPrefix": "*",
364 "destinationAddressPrefix": "*",
365 "access": "Allow",
366 "priority": 1100,
367 "direction": "Inbound"
368 }
369 },
370 {
371 "name": "https",
372 "properties": {
373 "protocol": "Tcp",
374 "sourcePortRange": "*",
375 "destinationPortRange": "443",
376 "sourceAddressPrefix": "*",
377 "destinationAddressPrefix": "*",
378 "access": "Allow",
379 "priority": 1200,
380 "direction": "Inbound"
381 }
382 }
383 ]
384 },
385 "resources": [],
386 "dependsOn": []
387 },
388 {
389 "comments": "",
390 "type": "Microsoft.Network/networkSecurityGroups",
391 "name": "[concat(variables('nsg-prefix'), variables('names')[1])]",
392 "apiVersion": "2017-03-01",
393 "location": "[resourceGroup().location]",
394 "properties": {
395 "securityRules": [
396 {
397 "name": "default-allow-ssh",
398 "properties": {
399 "protocol": "Tcp",
400 "sourcePortRange": "*",
401 "destinationPortRange": "22",
402 "sourceAddressPrefix": "*",
403 "destinationAddressPrefix": "*",
404 "access": "Allow",
405 "priority": 1000,
406 "direction": "Inbound"
407 }
408 }
409 ]
410 },
411 "resources": [],
412 "dependsOn": []
413 },
414 {
415 "comments": "",
416 "type": "Microsoft.Storage/storageAccounts",
417 "sku": {
418 "name": "Standard_LRS",
419 "tier": "Standard"
420 },
421 "kind": "Storage",
422 "name": "[variables('storage-name')]",
423 "apiVersion": "2016-01-01",
424 "location": "[resourceGroup().location]",
425 "tags": {},
426 "properties": { },
427 "resources": [],
428 "dependsOn": []
429 }
430 ],
431 "outputs": {
432 "sshCommand": {
433 "type": "string",
434 "value": "[concat('ssh ', variables('unique-prefix'), '-', variables('names')[0], '.', resourceGroup().location, '.cloudapp.azure.com')]"
435 }
436 }
437 }
438
439
440
441
442