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