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