multi/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 "vm-count": {
12 "type": "int"
13 }
14 },
15 "variables": {
16 "ssh-keypath": "[concat('/home/', parameters('admin-username'), '/.ssh/authorized_keys')]",
17 "unique-prefix": "[concat(replace(resourceGroup().name,'-',''), substring(uniquestring(resourceGroup().name), 0, 5))]",
18 "storage-name": "[variables('unique-prefix')]",
19 "vnet-name": "[concat(resourceGroup().name, '-vnet')]",
20 "ip-prefix": "[concat(resourceGroup().name, '-ip-')]",
21 "nsg-prefix": "[concat(resourceGroup().name, '-nsg-')]",
22 "vm-prefix": "[concat(resourceGroup().name, '-vm-')]",
23 "nic-prefix": "[concat(resourceGroup().name, '-nic-')]",
24 "names": [
25 "alpha",
26 "beta",
27 "gamma",
28 "delta",
29 "epsilon",
30 "zeta",
31 "eta",
32 "theta",
33 "iota",
34 "kappa",
35 "lambda",
36 "mu",
37 "nu",
38 "xi",
39 "omicron",
40 "pi",
41 "rho",
42 "sigma",
43 "tau",
44 "upsilon",
45 "phi",
46 "chi",
47 "psi",
48 "omega"
49 ],
50 "vm-size": "Standard_DS2_v2_Promo",
51 "vnet-address-space": "10.16.0.0/12",
52 "vnet-subnet01-octet": 17
53 },
54 "resources": [
55 {
56 "comments": "",
57 "type": "Microsoft.Network/publicIPAddresses",
58 "name": "[concat(variables('ip-prefix'), variables('names')[copyindex()])]",
59 "copy": {
60 "name": "vm-count",
61 "count": "[parameters('vm-count')]"
62 },
63 "apiVersion": "2017-03-01",
64 "location": "[resourceGroup().location]",
65 "properties": {
66 "publicIPAllocationMethod": "Dynamic",
67 "idleTimeoutInMinutes": 4,
68 "dnsSettings": {
69 "domainNameLabel": "[concat(variables('unique-prefix'), '-', variables('names')[copyindex()])]"
70 }
71 },
72 "resources": [],
73 "dependsOn": []
74 },
75 {
76 "comments": "public machine",
77 "type": "Microsoft.Compute/virtualMachines",
78 "name": "[concat(variables('vm-prefix'), variables('names')[copyindex()])]",
79 "copy": {
80 "name": "vm-count",
81 "count": "[parameters('vm-count')]"
82 },
83 "apiVersion": "2016-04-30-preview",
84 "location": "[resourceGroup().location]",
85 "properties": {
86 "hardwareProfile": {
87 "vmSize": "[variables('vm-size')]"
88 },
89 "storageProfile": {
90 "imageReference": {
91 "publisher": "OpenLogic",
92 "offer": "CentOS",
93 "sku": "7.2",
94 "version": "latest"
95 },
96 "osDisk": {
97 "name": "[concat(variables('vm-prefix'), variables('names')[copyindex()], '-boot')]",
98 "createOption": "FromImage",
99 "vhd": {
100 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[copyindex()], '-boot.vhd')]"
101 },
102 "caching": "ReadWrite"
103 },
104 "dataDisks": [
105 {
106 "name": "[concat(variables('vm-prefix'), variables('names')[copyindex()], '-disk01')]",
107 "diskSizeGB": 127,
108 "lun": 0,
109 "vhd": {
110 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[copyindex()], '-data01.vhd')]"
111 },
112 "createOption": "Empty"
113 }
114 ]
115 },
116 "osProfile": {
117 "computerName": "[concat(variables('vm-prefix'), variables('names')[copyindex()])]",
118 "adminUsername": "[parameters('admin-username')]",
119 "linuxConfiguration": {
120 "disablePasswordAuthentication": true,
121 "ssh": {
122 "publicKeys": [
123 {
124 "path": "[variables('ssh-keypath')]",
125 "keyData": "[parameters('ssh-public-key')]"
126 }
127 ]
128 }
129 }
130 },
131 "networkProfile": {
132 "networkInterfaces": [
133 {
134 "id": "[resourceId('Microsoft.Network/networkInterfaces', concat('nic-', variables('names')[copyindex()]))]"
135 }
136 ]
137 }
138 },
139 "resources": [],
140 "dependsOn": [
141 "[resourceId('Microsoft.Storage/storageAccounts', variables('storage-name'))]",
142 "[resourceId('Microsoft.Network/networkInterfaces', concat('nic-', variables('names')[copyindex()]))]"
143 ]
144 },
145 {
146 "comments": "public ip",
147 "type": "Microsoft.Network/networkInterfaces",
148 "name": "[concat('nic-', variables('names')[copyindex()])]",
149 "copy": {
150 "name": "vm-count",
151 "count": "[parameters('vm-count')]"
152 },
153 "apiVersion": "2017-03-01",
154 "location": "[resourceGroup().location]",
155 "properties": {
156 "ipConfigurations": [
157 {
158 "name": "ifconfig1",
159 "properties": {
160 "privateIPAllocationMethod": "Dynamic",
161 "publicIPAddress": {
162 "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[copyindex()]))]"
163 },
164 "subnet": {
165 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet01')]"
166 }
167 }
168 }
169 ],
170 "dnsSettings": {
171 "dnsServers": []
172 },
173 "enableIPForwarding": false,
174 "networkSecurityGroup": {
175 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[copyindex()]))]"
176 }
177 },
178 "resources": [],
179 "dependsOn": [
180 "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[copyindex()]))]",
181 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
182 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[copyindex()]))]"
183 ]
184 },
185 {
186 "comments": "",
187 "type": "Microsoft.Network/virtualNetworks",
188 "name": "[variables('vnet-name')]",
189 "apiVersion": "2017-03-01",
190 "location": "[resourceGroup().location]",
191 "properties": {
192 "addressSpace": {
193 "addressPrefixes": [
194 "[variables('vnet-address-space')]"
195 ]
196 },
197 "subnets": [
198 {
199 "name": "subnet01",
200 "properties": {
201 "addressPrefix": "[concat('10.', variables('vnet-subnet01-octet'), '.0.0/16')]"
202 }
203 }
204 ]
205 },
206 "resources": [],
207 "dependsOn": []
208 },
209 {
210 "comments": "",
211 "type": "Microsoft.Network/networkSecurityGroups",
212 "name": "[concat(variables('nsg-prefix'), variables('names')[copyindex()])]",
213 "apiVersion": "2017-03-01",
214 "copy": {
215 "name": "vm-count",
216 "count": "[parameters('vm-count')]"
217 },
218 "location": "[resourceGroup().location]",
219 "properties": {
220 "securityRules": [
221 {
222 "name": "default-allow-ssh",
223 "properties": {
224 "protocol": "Tcp",
225 "sourcePortRange": "*",
226 "destinationPortRange": "22",
227 "sourceAddressPrefix": "*",
228 "destinationAddressPrefix": "*",
229 "access": "Allow",
230 "priority": 1000,
231 "direction": "Inbound"
232 }
233 }
234 ]
235 },
236 "resources": [],
237 "dependsOn": []
238 },
239 {
240 "comments": "",
241 "type": "Microsoft.Storage/storageAccounts",
242 "sku": {
243 "name": "Standard_LRS",
244 "tier": "Standard"
245 },
246 "kind": "Storage",
247 "name": "[variables('storage-name')]",
248 "apiVersion": "2016-01-01",
249 "location": "[resourceGroup().location]",
250 "tags": {},
251 "properties": {},
252 "resources": [],
253 "dependsOn": []
254 }
255 ],
256 "outputs": {
257 "sshCommand": {
258 "type": "string",
259 "value": "[concat('ssh ', variables('unique-prefix'), '-', variables('names')[0], '.', resourceGroup().location, '.cloudapp.azure.com')]"
260 }
261 }
262 }
263
264
265
266