Skip to content

Commit 3893770

Browse files
authored
Merge pull request #233554 from JustPies/jprefresh-4-5
Freshness Pass for User Story: 79519
2 parents 7f126e7 + 132ff59 commit 3893770

File tree

1 file changed

+36
-35
lines changed

1 file changed

+36
-35
lines changed

articles/virtual-machines/windows/tutorial-secure-web-server.md

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
---
2-
title: "Tutorial: Secure a Windows web server with TLS/SSL certificates in Azure"
3-
description: In this tutorial, you learn how to use Azure PowerShell to secure a Windows virtual machine that runs the IIS web server with TLS/SSL certificates stored in Azure Key Vault.
2+
title: "Tutorial: Secure a Windows web server with TLS certificates in Azure"
3+
description: Learn how to use Azure PowerShell to secure a Windows virtual machine that runs the IIS web server with TLS certificates stored in Azure Key Vault.
44
author: cynthn
55
ms.service: virtual-machines
66
ms.collection: windows
77
ms.subservice: security
88
ms.topic: tutorial
99
ms.workload: infrastructure
10-
ms.date: 02/09/2018
10+
ms.date: 04/05/2023
1111
ms.author: cynthn
1212
ms.custom: mvc, devx-track-azurepowershell
1313

14-
#Customer intent: As an IT administrator or developer, I want to learn how to secure a web server with TLS/SSL certificates so that I can protect my customer data on web applications that I build and run.
14+
#Customer intent: As an IT administrator or developer, I want to learn how to secure a web server with TLS certificates so that I can protect my customer data on web applications that I build and run.
1515
---
1616

17-
# Tutorial: Secure a web server on a Windows virtual machine in Azure with TLS/SSL certificates stored in Key Vault
18-
**Applies to:** :heavy_check_mark: Windows VMs :heavy_check_mark: Flexible scale sets
17+
# Tutorial: Secure a web server on a Windows virtual machine in Azure with TLS certificates stored in Key Vault
18+
19+
**Applies to:** :heavy_check_mark: Windows VMs :heavy_check_mark: Flexible scale sets
1920

2021
> [!NOTE]
21-
> Currently this doc only works for Generalized images. If attempting this tutorial using a Specialized disk you will receive an error.
22+
> Currently, this doc only works for Generalized images. If you attempt this tutorial by using a Specialized disk you will receive an error.
2223
23-
To secure web servers, a Transport Layer Security (TLS), previously known as Secure Sockets Layer (SSL), certificate can be used to encrypt web traffic. These TLS/SSL certificates can be stored in Azure Key Vault, and allow secure deployments of certificates to Windows virtual machines (VMs) in Azure. In this tutorial you learn how to:
24+
To secure web servers, a Transport Layer Security (TLS) certificate can be used to encrypt web traffic. TLS certificates can be stored in Azure Key Vault and allow secure deployments of certificates to Windows virtual machines (VMs) in Azure. In this tutorial you learn how to:
2425

2526
> [!div class="checklist"]
26-
> * Create an Azure Key Vault
27-
> * Generate or upload a certificate to the Key Vault
28-
> * Create a VM and install the IIS web server
29-
> * Inject the certificate into the VM and configure IIS with a TLS binding
30-
27+
> * Create an Azure Key Vault.
28+
> * Generate or upload a certificate to the Key Vault.
29+
> * Create a VM and install the IIS web server.
30+
> * Inject the certificate into the VM and configure IIS with a TLS binding.
3131
3232
## Launch Azure Cloud Shell
3333

34-
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.
35-
36-
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.
34+
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.
3735

36+
To open the Cloud Shell, just 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 them into the Cloud Shell, and press enter to run them.
3837

3938
## Overview
40-
Azure Key Vault safeguards cryptographic keys and secrets, such certificates or passwords. Key Vault helps streamline the certificate management process and enables you to maintain control of keys that access those certificates. You can create a self-signed certificate inside Key Vault, or upload an existing, trusted certificate that you already own.
4139

42-
Rather than using a custom VM image that includes certificates baked-in, you inject certificates into a running VM. This process ensures that the most up-to-date certificates are installed on a web server during deployment. If you renew or replace a certificate, you don't also have to create a new custom VM image. The latest certificates are automatically injected as you create additional VMs. During the whole process, the certificates never leave the Azure platform or are exposed in a script, command-line history, or template.
40+
Azure Key Vault safeguards cryptographic keys and secrets, such as certificates or passwords. Key Vault helps streamline the certificate management process and enables you to maintain control of keys that access those certificates. You can create a self-signed certificate inside Key Vault, or you can upload an existing, trusted certificate that you already own.
4341

42+
Rather than by using a custom VM image that includes certificates baked-in, inject certificates into a running VM. This process ensures that the most up-to-date certificates are installed on a web server during deployment. If you renew or replace a certificate, you don't also have to create a new custom VM image. The latest certificates are automatically injected as you create more VMs. During the whole process, the certificates never leave the Azure platform or are exposed in a script, command-line history, or template.
4443

4544
## Create an Azure Key Vault
45+
4646
Before you can create a Key Vault and certificates, create a resource group with [New-AzResourceGroup](/powershell/module/az.resources/new-azresourcegroup). The following example creates a resource group named *myResourceGroupSecureWeb* in the *East US* location:
4747

4848
```azurepowershell-interactive
@@ -51,7 +51,7 @@ $location = "East US"
5151
New-AzResourceGroup -ResourceGroupName $resourceGroup -Location $location
5252
```
5353

54-
Next, create a Key Vault with [New-AzKeyVault](/powershell/module/az.keyvault/new-azkeyvault). Each Key Vault requires a unique name, and should be all lower case. Replace `mykeyvault` in the following example with your own unique Key Vault name:
54+
Next, create a Key Vault with [New-AzKeyVault](/powershell/module/az.keyvault/new-azkeyvault). Each Key Vault requires a unique name and should be all lower case. Replace `mykeyvault` with your own unique Key Vault name in the following example:
5555

5656
```azurepowershell-interactive
5757
$keyvaultName="mykeyvault"
@@ -61,8 +61,9 @@ New-AzKeyVault -VaultName $keyvaultName `
6161
-EnabledForDeployment
6262
```
6363

64-
## Generate a certificate and store in Key Vault
65-
For production use, you should import a valid certificate signed by trusted provider with [Import-AzKeyVaultCertificate](/powershell/module/az.keyvault/import-azkeyvaultcertificate). For this tutorial, the following example shows how you can generate a self-signed certificate with [Add-AzKeyVaultCertificate](/powershell/module/az.keyvault/add-azkeyvaultcertificate) that uses the default certificate policy from [New-AzKeyVaultCertificatePolicy](/powershell/module/az.keyvault/new-azkeyvaultcertificatepolicy).
64+
## Generate a certificate and store it in Key Vault
65+
66+
For production use, you should import a valid certificate signed by a trusted provider with [Import-AzKeyVaultCertificate](/powershell/module/az.keyvault/import-azkeyvaultcertificate). For this tutorial, the following example shows how you can generate a self-signed certificate with [Add-AzKeyVaultCertificate](/powershell/module/az.keyvault/add-azkeyvaultcertificate) that uses the default certificate policy from [New-AzKeyVaultCertificatePolicy](/powershell/module/az.keyvault/new-azkeyvaultcertificatepolicy).
6667

6768
```azurepowershell-interactive
6869
$policy = New-AzKeyVaultCertificatePolicy `
@@ -77,15 +78,15 @@ Add-AzKeyVaultCertificate `
7778
-CertificatePolicy $policy
7879
```
7980

80-
8181
## Create a virtual machine
82+
8283
Set an administrator username and password for the VM with [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential):
8384

8485
```azurepowershell-interactive
8586
$cred = Get-Credential
8687
```
8788

88-
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 supporting network resources are created. To allow secure web traffic, the cmdlet also opens port *443*.
89+
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 supporting network resources are created. To allow secure web traffic, the cmdlet also opens port *443*.
8990

9091
```azurepowershell-interactive
9192
# Create a VM
@@ -113,8 +114,8 @@ Set-AzVMExtension -ResourceGroupName $resourceGroup `
113114

114115
It takes a few minutes for the VM to be created. The last step uses the Azure Custom Script Extension to install the IIS web server with [Set-AzVmExtension](/powershell/module/az.compute/set-azvmextension).
115116

116-
117117
## Add a certificate to VM from Key Vault
118+
118119
To add the certificate from Key Vault to a VM, obtain the ID of your certificate with [Get-AzKeyVaultSecret](/powershell/module/az.keyvault/get-azkeyvaultsecret). Add the certificate to the VM with [Add-AzVMSecret](/powershell/module/az.compute/add-azvmsecret):
119120

120121
```azurepowershell-interactive
@@ -127,8 +128,8 @@ $vm = Add-AzVMSecret -VM $vm -SourceVaultId $vaultId -CertificateStore "My" -Cer
127128
Update-AzVM -ResourceGroupName $resourceGroup -VM $vm
128129
```
129130

130-
131131
## Configure IIS to use the certificate
132+
132133
Use the Custom Script Extension again with [Set-AzVMExtension](/powershell/module/az.compute/set-azvmextension) to update the IIS configuration. This update applies the certificate injected from Key Vault to IIS and configures the web binding:
133134

134135
```azurepowershell-interactive
@@ -147,8 +148,8 @@ Set-AzVMExtension -ResourceGroupName $resourceGroup `
147148
-SettingString $publicSettings
148149
```
149150

150-
151151
### Test the secure web app
152+
152153
Obtain the public IP address of your VM with [Get-AzPublicIPAddress](/powershell/module/az.network/get-azpublicipaddress). The following example obtains the IP address for `myPublicIP` created earlier:
153154

154155
```azurepowershell-interactive
@@ -157,23 +158,23 @@ Get-AzPublicIPAddress -ResourceGroupName $resourceGroup -Name "myPublicIPAddress
157158

158159
Now you can open a web browser and enter `https://<myPublicIP>` in the address bar. To accept the security warning if you used a self-signed certificate, select **Details** and then **Go on to the webpage**:
159160

160-
![Accept web browser security warning](./media/tutorial-secure-web-server/browser-warning.png)
161+
:::image type="content" source="./media/tutorial-secure-web-server/browser-warning.png" alt-text="Screenshot of web browser security warning.":::
161162

162163
Your secured IIS website is then displayed as in the following example:
163164

164-
![View running secure IIS site](./media/tutorial-secure-web-server/secured-iis.png)
165-
165+
:::image type="content" source="./media/tutorial-secure-web-server/secured-iis.png" alt-text="Screenshot of browser, showing secure IIS site.":::
166166

167167
## Next steps
168-
In this tutorial, you secured an IIS web server with a TLS/SSL certificate stored in Azure Key Vault. You learned how to:
168+
169+
In this tutorial, you secured an IIS web server with a TLS certificate stored in Azure Key Vault. You learned how to:
169170

170171
> [!div class="checklist"]
171-
> * Create an Azure Key Vault
172-
> * Generate or upload a certificate to the Key Vault
173-
> * Create a VM and install the IIS web server
174-
> * Inject the certificate into the VM and configure IIS with a TLS binding
172+
> * Create an Azure Key Vault.
173+
> * Generate or upload a certificate to the Key Vault.
174+
> * Create a VM and install the IIS web server.
175+
> * Inject the certificate into the VM and configure IIS with a TLS binding.
175176
176-
Follow this link to see pre-built virtual machine script samples.
177+
For prebuilt virtual machine script samples, see:
177178

178179
> [!div class="nextstepaction"]
179180
> [Windows virtual machine script samples](https://github.com/Azure/azure-docs-powershell-samples/tree/master/virtual-machine)

0 commit comments

Comments
 (0)