Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ab8499a

Browse files
committedApr 20, 2018
mvc-08
1 parent d17cdcd commit ab8499a

File tree

6 files changed

+142
-0
lines changed

6 files changed

+142
-0
lines changed
 
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Azure PowerShell Script Sample - Manage web traffic | Microsoft Docs
3+
description: Azure PowerShell Script Sample - Manage web traffic with an application gateway and a virtual machine scale set.
4+
services: application-gateway
5+
documentationcenter: networking
6+
author: davidmu1
7+
manager: timlt
8+
editor: tysonn
9+
tags: azure-resource-manager
10+
11+
ms.service: application-gateway
12+
ms.topic: sample
13+
ms.tgt_pltfrm: vm-windows
14+
ms.workload: infrastructure
15+
ms.date: 01/29/2018
16+
ms.author: davidmu
17+
ms.custom: mvc
18+
---
19+
20+
# Manage web traffic with Azure PowerShell
21+
22+
This script creates an application gateway that uses a virtual machine scale set for backend servers. The application gateway can then be configured to manage web traffic. After running the script, you can test the application gateway using its public IP address.
23+
24+
[!INCLUDE [sample-powershell-install](../../../includes/sample-powershell-install-no-ssh.md)]
25+
26+
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
27+
28+
## Sample script
29+
30+
[!code-powershell[main](../../../powershell_scripts/application-gateway/create-vmss/create-vmss.ps1 "Create application gateway")]
31+
32+
## Clean up deployment
33+
34+
Run the following command to remove the resource group, application gateway, and all related resources.
35+
36+
```powershell
37+
Remove-AzureRmResourceGroup -Name myResourceGroupAG
38+
```
39+
40+
## Script explanation
41+
42+
This script uses the following commands to create the deployment. Each item in the table links to command specific documentation.
43+
44+
| Command | Notes |
45+
|---|---|
46+
| [New-AzureRmResourceGroup](/powershell/module/azurerm.resources/new-azurermresourcegroup) | Creates a resource group in which all resources are stored. |
47+
| [New-AzureRmVirtualNetworkSubnetConfig](/powershell/module/azurerm.network/new-azurermvirtualnetworksubnetconfig) | Creates the subnet configuration. |
48+
| [New-AzureRmVirtualNetwork](/powershell/module/azurerm.network/new-azurermvirtualnetwork) | Creates the virtual network using with the subnet configurations. |
49+
| [New-AzureRmPublicIpAddress](/powershell/module/azurerm.network/new-azurermpublicipaddress) | Creates the public IP address for the application gateway. |
50+
| [New-AzureRmApplicationGatewayIPConfiguration](/powershell/module/azurerm.network/new-azurermapplicationgatewayipconfiguration) | Creates the configuration that associates a subnet with the application gateway. |
51+
| [New-AzureRmApplicationGatewayFrontendIPConfig](/powershell/module/azurerm.network/new-azurermapplicationgatewayfrontendipconfig) | Creates the configuration that assigns a public IP address to the application gateway. |
52+
| [New-AzureRmApplicationGatewayFrontendPort](/powershell/module/azurerm.network/new-azurermapplicationgatewayfrontendport) | Assigns a port to be used to access the application gateway. |
53+
| [New-AzureRmApplicationGatewayBackendAddressPool](/powershell/module/azurerm.network/new-azurermapplicationgatewaybackendaddresspool) | Creates a backend pool for an application gateway. |
54+
| [New-AzureRmApplicationGatewayBackendHttpSettings](/powershell/module/azurerm.network/new-azurermapplicationgatewaybackendhttpsettings) | Configures settings for a backend pool. |
55+
| [New-AzureRmApplicationGatewayHttpListener](/powershell/module/azurerm.network/new-azurermapplicationgatewayhttplistener) | Creates a listener. |
56+
| [New-AzureRmApplicationGatewayRequestRoutingRule](/powershell/module/azurerm.network/new-azurermapplicationgatewayrequestroutingrule) | Creates a routing rule. |
57+
| [New-AzureRmApplicationGatewaySku](/powershell/module/azurerm.network/new-azurermapplicationgatewaysku) | Specify the tier and capacity for an application gateway. |
58+
| [New-AzureRmApplicationGateway](/powershell/module/azurerm.network/new-azurermapplicationgateway) | Create an application gateway. |
59+
| [Set-AzureRmVmssStorageProfile](/powershell/module/azurerm.compute/set-azurermvmssstorageprofile) | Create a storage profile for the scale set. |
60+
| [Set-AzureRmVmssOsProfile](/powershell/module/azurerm.compute/set-azurermvmssosprofile) | Define the operating system for the scale set. |
61+
| [Add-AzureRmVmssNetworkInterfaceConfiguration](/powershell/module/azurerm.compute/add-azurermvmssnetworkinterfaceconfiguration) | Define the network interface for the scale set. |
62+
| [New-AzureRmVmss](/powershell/module/azurerm.compute/new-azurermvm) | Create a virtual machine scale set. |
63+
| [Get-AzureRmPublicIPAddress](/powershell/module/azurerm.network/get-azurermpublicipaddress) | Gets the public IP address of an application gateway. |
64+
|[Remove-AzureRmResourceGroup](/powershell/module/azurerm.resources/remove-azurermresourcegroup) | Removes a resource group and all resources contained within. |
65+
66+
## Next steps
67+
68+
For more information on the Azure PowerShell module, see [Azure PowerShell documentation](/powershell/azure/overview).
69+
70+
Additional application gateway PowerShell script samples can be found in the [Azure Application Gateway documentation](../powershell-samples.md).
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: Azure PowerShell Script Sample - Restrict web traffic | Microsoft Docs
3+
description: Azure PowerShell Script Sample - Create an application gateway with a web application firewall and a virtual machine scale set that uses OWASP rules to restrict traffic.
4+
services: application-gateway
5+
documentationcenter: networking
6+
author: davidmu1
7+
manager: timlt
8+
editor: tysonn
9+
tags: azure-resource-manager
10+
11+
ms.service: application-gateway
12+
ms.topic: sample
13+
ms.tgt_pltfrm: vm-windows
14+
ms.workload: infrastructure
15+
ms.date: 01/29/2018
16+
ms.author: davidmu
17+
ms.custom: mvc
18+
---
19+
20+
# Restrict web traffic using Azure PowerShell
21+
22+
This script creates an application gateway with a web application firewall that uses a virtual machine scale set for backend servers. The web application firewall restricts web traffic based on OWASP rules. After running the script, you can test the application gateway using its public IP address.
23+
24+
[!INCLUDE [sample-powershell-install](../../../includes/sample-powershell-install-no-ssh.md)]
25+
26+
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
27+
28+
## Sample script
29+
30+
[!code-powershell[main](../../../powershell_scripts/application-gateway/create-vmss/create-vmss-waf.ps1 "Create application gateway with WAF")]
31+
32+
## Clean up deployment
33+
34+
Run the following command to remove the resource group, application gateway, and all related resources.
35+
36+
```powershell
37+
Remove-AzureRmResourceGroup -Name myResourceGroupAG
38+
```
39+
40+
## Script explanation
41+
42+
This script uses the following commands to create the deployment. Each item in the table links to command specific documentation.
43+
44+
| Command | Notes |
45+
|---|---|
46+
| [New-AzureRmResourceGroup](/powershell/module/azurerm.resources/new-azurermresourcegroup) | Creates a resource group in which all resources are stored. |
47+
| [New-AzureRmVirtualNetworkSubnetConfig](/powershell/module/azurerm.network/new-azurermvirtualnetworksubnetconfig) | Creates the subnet configuration. |
48+
| [New-AzureRmVirtualNetwork](/powershell/module/azurerm.network/new-azurermvirtualnetwork) | Creates the virtual network using with the subnet configurations. |
49+
| [New-AzureRmPublicIpAddress](/powershell/module/azurerm.network/new-azurermpublicipaddress) | Creates the public IP address for the application gateway. |
50+
| [New-AzureRmApplicationGatewayIPConfiguration](/powershell/module/azurerm.network/new-azurermapplicationgatewayipconfiguration) | Creates the configuration that associates a subnet with the application gateway. |
51+
| [New-AzureRmApplicationGatewayFrontendIPConfig](/powershell/module/azurerm.network/new-azurermapplicationgatewayfrontendipconfig) | Creates the configuration that assigns a public IP address to the application gateway. |
52+
| [New-AzureRmApplicationGatewayFrontendPort](/powershell/module/azurerm.network/new-azurermapplicationgatewayfrontendport) | Assigns a port to be used to access the application gateway. |
53+
| [New-AzureRmApplicationGatewayBackendAddressPool](/powershell/module/azurerm.network/new-azurermapplicationgatewaybackendaddresspool) | Creates a backend pool for an application gateway. |
54+
| [New-AzureRmApplicationGatewayBackendHttpSettings](/powershell/module/azurerm.network/new-azurermapplicationgatewaybackendhttpsettings) | Configures settings for a backend pool. |
55+
| [New-AzureRmApplicationGatewayHttpListener](/powershell/module/azurerm.network/new-azurermapplicationgatewayhttplistener) | Creates a listener. |
56+
| [New-AzureRmApplicationGatewayRequestRoutingRule](/powershell/module/azurerm.network/new-azurermapplicationgatewayrequestroutingrule) | Creates a routing rule. |
57+
| [New-AzureRmApplicationGatewaySku](/powershell/module/azurerm.network/new-azurermapplicationgatewaysku) | Specify the tier and capacity for an application gateway. |
58+
| [New-AzureRmApplicationGatewayWebApplicationFirewallConfiguration](/powershell/module/azurerm.network/new-azurermapplicationgatewaywebapplicationfirewallconfiguration) | Creates the web application firewall configuration. |
59+
| [New-AzureRmApplicationGateway](/powershell/module/azurerm.network/new-azurermapplicationgateway) | Create an application gateway. |
60+
| [Set-AzureRmVmssStorageProfile](/powershell/module/azurerm.compute/set-azurermvmssstorageprofile) | Create a storage profile for the scale set. |
61+
| [Set-AzureRmVmssOsProfile](/powershell/module/azurerm.compute/set-azurermvmssosprofile) | Define the operating system for the scale set. |
62+
| [Add-AzureRmVmssNetworkInterfaceConfiguration](/powershell/module/azurerm.compute/add-azurermvmssnetworkinterfaceconfiguration) | Define the network interface for the scale set. |
63+
| [New-AzureRmVmss](/powershell/module/azurerm.compute/new-azurermvm) | Create a virtual machine scale set. |
64+
| [New-AzureRmStorageAccount](/powershell/module/azurerm.storage/new-azurermstorageaccount) | Creates a storage account. |
65+
| [Set-AzureRmDiagnosticSetting](/powershell/module/azurerm.insights/set-azurermdiagnosticsetting) | Configures diagnostics to record data. |
66+
| [Get-AzureRmPublicIPAddress](/powershell/module/azurerm.network/get-azurermpublicipaddress) | Gets the public IP address of an application gateway. |
67+
|[Remove-AzureRmResourceGroup](/powershell/module/azurerm.resources/remove-azurermresourcegroup) | Removes a resource group and all resources contained within. |
68+
## Next steps
69+
70+
For more information on the Azure PowerShell module, see [Azure PowerShell documentation](/powershell/azure/overview).
71+
72+
Additional application gateway PowerShell script samples can be found in the [Azure Application Gateway documentation](../powershell-samples.md).

0 commit comments

Comments
 (0)
Please sign in to comment.