Skip to content

Commit 79fad8a

Browse files
committed
update the vm extension article
1 parent 5049c2a commit 79fad8a

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

articles/azure-resource-manager/templates/template-tutorial-deploy-vm-extensions.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Deploy VM extensions with template
33
description: Learn how to deploy virtual machine extensions with Azure Resource Manager templates
44
author: mumian
5-
ms.date: 03/31/2020
5+
ms.date: 04/16/2020
66
ms.topic: tutorial
77
ms.author: jgao
88
---
@@ -37,13 +37,13 @@ To complete this article, you need:
3737

3838
## Prepare a PowerShell script
3939

40-
A PowerShell script with the following content is shared from [GitHub](https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/tutorial-vm-extension/installWebServer.ps1):
40+
You can use inline PowerShell script or a script file. This tutorial shows how to use a script file. A PowerShell script with the following content is shared from [GitHub](https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/tutorial-vm-extension/installWebServer.ps1):
4141

4242
```azurepowershell
4343
Install-WindowsFeature -name Web-Server -IncludeManagementTools
4444
```
4545

46-
If you choose to publish the file to your own location, you must update the `fileUri` element in the template later in the tutorial.
46+
If you choose to publish the file to your own location, update the `fileUri` element in the template later in the tutorial.
4747

4848
## Open a quickstart template
4949

@@ -55,11 +55,12 @@ Azure Quickstart Templates is a repository for ARM templates. Instead of creatin
5555
1. To open the file, select **Open**.
5656
The template defines five resources:
5757

58-
* **Microsoft.Storage/storageAccounts**. See the [template reference](https://docs.microsoft.com/azure/templates/Microsoft.Storage/storageAccounts).
59-
* **Microsoft.Network/publicIPAddresses**. See the [template reference](https://docs.microsoft.com/azure/templates/microsoft.network/publicipaddresses).
60-
* **Microsoft.Network/virtualNetworks**. See the [template reference](https://docs.microsoft.com/azure/templates/microsoft.network/virtualnetworks).
61-
* **Microsoft.Network/networkInterfaces**. See the [template reference](https://docs.microsoft.com/azure/templates/microsoft.network/networkinterfaces).
62-
* **Microsoft.Compute/virtualMachines**. See the [template reference](https://docs.microsoft.com/azure/templates/microsoft.compute/virtualmachines).
58+
* [**Microsoft.Storage/storageAccounts**](/azure/templates/Microsoft.Storage/storageAccounts).
59+
* [**Microsoft.Network/publicIPAddresses**](/azure/templates/microsoft.network/publicipaddresses).
60+
* [**Microsoft.Network/networkSecurityGroups**](/azure/templates/microsoft.network/networksecuritygroups).
61+
* [**Microsoft.Network/virtualNetworks**](/azure/templates/microsoft.network/virtualnetworks).
62+
* [**Microsoft.Network/networkInterfaces**](/azure/templates/microsoft.network/networkinterfaces).
63+
* [**Microsoft.Compute/virtualMachines**](/azure/templates/microsoft.compute/virtualmachines).
6364

6465
It's helpful to get some basic understanding of the template before you customize it.
6566

@@ -72,7 +73,7 @@ Add a virtual machine extension resource to the existing template with the follo
7273
```json
7374
{
7475
"type": "Microsoft.Compute/virtualMachines/extensions",
75-
"apiVersion": "2018-06-01",
76+
"apiVersion": "2019-12-01",
7677
"name": "[concat(variables('vmName'),'/', 'InstallWebServer')]",
7778
"location": "[parameters('location')]",
7879
"dependsOn": [
@@ -100,6 +101,14 @@ For more information about this resource definition, see the [extension referenc
100101
* **fileUris**: The locations where the script files are stored. If you choose not to use the provided location, you need to update the values.
101102
* **commandToExecute**: This command invokes the script.
102103

104+
To use inline script, remove **fileUris**, and update **commandToExecute** to:
105+
106+
```powershell
107+
powershell.exe Install-WindowsFeature -name Web-Server -IncludeManagementTools && powershell.exe remove-item 'C:\\inetpub\\wwwroot\\iisstart.htm' && powershell.exe Add-Content -Path 'C:\\inetpub\\wwwroot\\iisstart.htm' -Value $('Hello World from ' + $env:computername)
108+
```
109+
110+
This inline script also update the iisstart.html content.
111+
103112
You must also open the HTTP port so that you would be able to access the web server.
104113

105114
1. Find **securityRules** in the template.

0 commit comments

Comments
 (0)