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