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