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