You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-machines/windows/tutorial-automate-vm-deployment.md
+22-21Lines changed: 22 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,50 +1,52 @@
1
1
---
2
2
title: Tutorial - Install applications on a Windows VM in Azure
3
-
description: In this tutorial, you learn how to use the Custom Script Extension to run scripts and deploy applications to Windows virtual machines in Azure
3
+
description: Learn how to use the Custom Script Extension to run scripts and deploy applications to Windows virtual machines in Azure.
4
4
author: cynthn
5
5
ms.service: virtual-machines
6
6
ms.collection: windows
7
7
ms.topic: tutorial
8
8
ms.workload: infrastructure
9
-
ms.date: 11/29/2018
9
+
ms.date: 04/07/2023
10
10
ms.author: cynthn
11
11
ms.custom: mvc, devx-track-azurepowershell
12
12
13
-
#Customer intent: As an IT administrator or developer, I want learn about how to install applications on Windows VMs so that I can automate the process and reduce the risk of human error of manual configuration tasks.
13
+
#Customer intent: As an IT administrator or developer, I want to learn about how to install applications on Windows VMs so that I can automate the process and reduce the risk of human error of manual configuration tasks.
14
14
---
15
15
16
16
# Tutorial - Deploy applications to a Windows virtual machine in Azure with the Custom Script Extension
To configure virtual machines (VMs) in a quick and consistent manner, you can use the [Custom Script Extension for Windows](../extensions/custom-script-windows.md). In this tutorial you learn how to:
20
21
21
22
> [!div class="checklist"]
22
-
> * Use the Custom Script Extension to install IIS
23
-
> * Create a VM that uses the Custom Script Extension
24
-
> * View a running IIS site after the extension is applied
23
+
> * Use the Custom Script Extension to install IIS.
24
+
> * Create a VM that uses the Custom Script Extension.
25
+
> * View a running IIS site after the extension is applied.
25
26
26
27
## Launch Azure Cloud Shell
27
28
28
-
The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common Azure tools preinstalled and configured to use with your account.
29
+
The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common Azure tools preinstalled and configured to use with your account.
29
30
30
-
To open the Cloud Shell, just select **Try it** from the upper right corner of a code block. You can also launch Cloud Shell in a separate browser tab by going to [https://shell.azure.com/powershell](https://shell.azure.com/powershell). Select **Copy** to copy the blocks of code, paste it into the Cloud Shell, and press enter to run it.
31
+
To open the Cloud Shell, select **Open Cloudshell** from the upper right corner of a code block. You can also launch Cloud Shell in a separate browser tab by going to [https://shell.azure.com/powershell](https://shell.azure.com/powershell). Select **Copy** to copy the blocks of code, paste it into the Cloud Shell, and press enter to run it.
31
32
32
33
## Custom script extension overview
33
-
The Custom Script Extension downloads and executes scripts on Azure VMs. This extension is useful for post deployment configuration, software installation, or any other configuration / management task. Scripts can be downloaded from Azure storage or GitHub, or provided to the Azure portal at extension run time.
34
34
35
-
The Custom Script extension integrates with Azure Resource Manager templates, and can also be run using the Azure CLI, PowerShell, Azure portal, or the Azure Virtual Machine REST API.
35
+
The Custom Script Extension downloads and executes scripts on Azure VMs. This extension is useful for post-deployment configuration, software installation, or any other configuration or management task. You can download scripts from Azure storage or GitHub, or you can provide scripts to the Azure portal at extension run time.
36
36
37
-
You can use the Custom Script Extension with both Windows and Linux VMs.
37
+
The Custom Script extension integrates with Azure Resource Manager templates and can be run by using the Azure CLI, PowerShell, Azure portal, or the Azure Virtual Machine REST API.
38
38
39
+
You can use the Custom Script Extension with both Linux and Windows VMs.
39
40
40
41
## Create virtual machine
42
+
41
43
Set the administrator username and password for the VM with [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential):
42
44
43
45
```azurepowershell-interactive
44
46
$cred = Get-Credential
45
47
```
46
48
47
-
Now you can create the VM with [New-AzVM](/powershell/module/az.compute/new-azvm). The following example creates a VM named *myVM* in the *EastUS* location. If they do not already exist, the resource group *myResourceGroupAutomate* and supporting network resources are created. To allow web traffic, the cmdlet also opens port *80*.
49
+
Now you can create the VM with [New-AzVM](/powershell/module/az.compute/new-azvm). The following example creates a VM named *myVM* in the *EastUS* location. If they don't already exist, the resource group *myResourceGroupAutomate* and supporting network resources are created. To allow web traffic, the cmdlet also opens port *80*.
48
50
49
51
```azurepowershell-interactive
50
52
New-AzVm `
@@ -59,10 +61,10 @@ New-AzVm `
59
61
-Credential $cred
60
62
```
61
63
62
-
It takes a few minutes for the resources and VM to be created.
63
-
64
+
The resources and VM take a few minutes to be created.
64
65
65
66
## Automate IIS install
67
+
66
68
Use [Set-AzVMExtension](/powershell/module/az.compute/set-azvmextension) to install the Custom Script Extension. The extension runs `powershell Add-WindowsFeature Web-Server` to install the IIS webserver and then updates the *Default.htm* page to show the hostname of the VM:
Obtain the public IP address of your load balancer with [Get-AzPublicIPAddress](/powershell/module/az.network/get-azpublicipaddress). The following example obtains the IP address for *myPublicIPAddress* created earlier:
82
+
83
+
Obtain the public IP address of your load balancer with [Get-AzPublicIPAddress](/powershell/module/az.network/get-azpublicipaddress). The following example obtains the IP address for `myPublicIPAddress` created earlier:
82
84
83
85
```azurepowershell-interactive
84
86
Get-AzPublicIPAddress `
@@ -88,17 +90,16 @@ Get-AzPublicIPAddress `
88
90
89
91
You can then enter the public IP address in to a web browser. The website is displayed, including the hostname of the VM that the load balancer distributed traffic to as in the following example:
:::image type="content" source="./media/tutorial-automate-vm-deployment/running-iis-website.png" alt-text="Screenshot of the public IP address in a web browser.":::
93
94
94
95
## Next steps
95
96
96
97
In this tutorial, you automated the IIS install on a VM. You learned how to:
97
98
98
99
> [!div class="checklist"]
99
-
> * Use the Custom Script Extension to install IIS
100
-
> * Create a VM that uses the Custom Script Extension
101
-
> * View a running IIS site after the extension is applied
100
+
> * Use the Custom Script Extension to install IIS.
101
+
> * Create a VM that uses the Custom Script Extension.
102
+
> * View a running IIS site after the extension is applied.
102
103
103
104
Advance to the next tutorial to learn how to create custom VM images.
0 commit comments