Skip to content

Commit 5fd3fc8

Browse files
Update marketplace-images.md
Added steps for deploying through JSON template using plan information.
1 parent db7d0be commit 5fd3fc8

File tree

1 file changed

+175
-0
lines changed

1 file changed

+175
-0
lines changed

articles/virtual-machines/marketplace-images.md

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,181 @@ New-AzVM `
140140
-Location $location `
141141
-VM $vmConfig
142142
```
143+
``` ARM Template
144+
# Create VM using Plan information through JSON
145+
{
146+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
147+
"contentVersion": "1.0.0.0",
148+
149+
"parameters": {
150+
"adminUsername": {
151+
"type": "string",
152+
"metadata": {
153+
"description": "Username for the Virtual Machine."
154+
}
155+
},
156+
"adminPassword": {
157+
"type": "securestring",
158+
"metadata": {
159+
"description": "Password for the Virtual Machine."
160+
}
161+
},
162+
163+
"location": {
164+
"type": "string",
165+
"defaultValue": "[resourceGroup().location]",
166+
"metadata": {
167+
"description": "Location for all resources."
168+
}
169+
}
170+
},
171+
"variables": {
172+
"nicName": "myVMNic",
173+
"addressPrefix": "10.0.0.0/16",
174+
"subnetName": "Subnet",
175+
"subnetPrefix": "10.0.0.0/24",
176+
"subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]",
177+
"vmName": "perflabwin10",
178+
"virtualNetworkName": "MyVNET",
179+
"publicIPAddressName": "myPublicIP",
180+
"dnsNameForPublicIP": "[uniqueString(resourceGroup().id)]",
181+
"networkSecurityGroupName": "default-NSG"
182+
},
183+
"resources": [
184+
{
185+
"apiVersion": "2017-06-01",
186+
"type": "Microsoft.Network/publicIPAddresses",
187+
"name": "[variables('publicIPAddressName')]",
188+
"location": "[parameters('location')]",
189+
"properties": {
190+
"publicIPAllocationMethod": "Dynamic",
191+
"dnsSettings": {
192+
"domainNameLabel": "[variables('dnsNameForPublicIP')]"
193+
}
194+
}
195+
},
196+
{
197+
"comments": "Default Network Security Group for template",
198+
"type": "Microsoft.Network/networkSecurityGroups",
199+
"apiVersion": "2019-08-01",
200+
"name": "[variables('networkSecurityGroupName')]",
201+
"location": "[parameters('location')]",
202+
"properties": {
203+
"securityRules": [
204+
{
205+
"name": "default-allow-3389",
206+
"properties": {
207+
"priority": 1000,
208+
"access": "Allow",
209+
"direction": "Inbound",
210+
"destinationPortRange": "3389",
211+
"protocol": "Tcp",
212+
"sourceAddressPrefix": "*",
213+
"sourcePortRange": "*",
214+
"destinationAddressPrefix": "*"
215+
}
216+
}
217+
]
218+
}
219+
},
220+
{
221+
"apiVersion": "2018-04-01",
222+
"type": "Microsoft.Network/virtualNetworks",
223+
"name": "[variables('virtualNetworkName')]",
224+
"location": "[parameters('location')]",
225+
"dependsOn": [
226+
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
227+
],
228+
"properties": {
229+
"addressSpace": {
230+
"addressPrefixes": [
231+
"[variables('addressPrefix')]"
232+
]
233+
},
234+
"subnets": [
235+
{
236+
"name": "[variables('subnetName')]",
237+
"properties": {
238+
"addressPrefix": "[variables('subnetPrefix')]",
239+
"networkSecurityGroup": {
240+
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
241+
}
242+
}
243+
}
244+
]
245+
}
246+
},
247+
{
248+
"apiVersion": "2018-04-01",
249+
"type": "Microsoft.Network/networkInterfaces",
250+
"name": "[variables('nicName')]",
251+
"location": "[parameters('location')]",
252+
"dependsOn": [
253+
"[variables('publicIPAddressName')]",
254+
"[variables('virtualNetworkName')]"
255+
],
256+
"properties": {
257+
"ipConfigurations": [
258+
{
259+
"name": "ipconfig1",
260+
"properties": {
261+
"privateIPAllocationMethod": "Dynamic",
262+
"publicIPAddress": {
263+
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
264+
},
265+
"subnet": {
266+
"id": "[variables('subnetRef')]"
267+
}
268+
}
269+
}
270+
]
271+
}
272+
},
273+
{
274+
"apiVersion": "2018-04-01",
275+
"type": "Microsoft.Compute/virtualMachines",
276+
"name": "[variables('vmName')]",
277+
"location": "[parameters('location')]",
278+
"dependsOn": [
279+
"[variables('nicName')]"
280+
],
281+
"plan": {
282+
"name": "xxxx",
283+
"publisher": "xxxx",
284+
"product": "xxxx"
285+
},
286+
"properties": {
287+
"hardwareProfile": {
288+
"vmSize": "Standard_D4s_v3"
289+
},
290+
"osProfile": {
291+
"computerName": "[variables('vmName')]",
292+
"adminUsername": "[parameters('adminUsername')]",
293+
"adminPassword": "[parameters('adminPassword')]"
294+
},
295+
"storageProfile": {
296+
"imageReference": {
297+
"id": "<Provide Image URI>"
298+
299+
},
300+
"osDisk": {
301+
"createOption": "FromImage"
302+
}
303+
},
304+
"networkProfile": {
305+
"networkInterfaces": [
306+
{
307+
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
308+
}
309+
]
310+
}
311+
}
312+
313+
}
314+
]
315+
316+
}
317+
````
143318
144319
## Next steps
145320

0 commit comments

Comments
 (0)