dns-bind/azuredeploy.json

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