Skip to content

Latest commit

 

History

History
72 lines (55 loc) · 5.1 KB

create-vmss-waf-powershell.md

File metadata and controls

72 lines (55 loc) · 5.1 KB
title description services documentationcenter author tags ms.service ms.topic ms.tgt_pltfrm ms.workload ms.date ms.author ms.custom
Azure PowerShell Script Sample - Restrict web traffic | Microsoft Docs
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.
application-gateway
networking
greg-lindsay
azure-resource-manager
application-gateway
sample
vm-windows
infrastructure
01/29/2018
greglin
mvc, devx-track-azurepowershell

Restrict web traffic using Azure PowerShell

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.

[!INCLUDE sample-powershell-install]

[!INCLUDE quickstarts-free-trial-note]

Sample script

[!code-powershellmain]

Clean up deployment

Run the following command to remove the resource group, application gateway, and all related resources.

Remove-AzResourceGroup -Name myResourceGroupAG

Script explanation

This script uses the following commands to create the deployment. Each item in the table links to command specific documentation.

Command Notes
New-AzResourceGroup Creates a resource group in which all resources are stored.
New-AzVirtualNetworkSubnetConfig Creates the subnet configuration.
New-AzVirtualNetwork Creates the virtual network using with the subnet configurations.
New-AzPublicIpAddress Creates the public IP address for the application gateway.
New-AzApplicationGatewayIPConfiguration Creates the configuration that associates a subnet with the application gateway.
New-AzApplicationGatewayFrontendIPConfig Creates the configuration that assigns a public IP address to the application gateway.
New-AzApplicationGatewayFrontendPort Assigns a port to be used to access the application gateway.
New-AzApplicationGatewayBackendAddressPool Creates a backend pool for an application gateway.
New-AzApplicationGatewayBackendHttpSettings Configures settings for a backend pool.
New-AzApplicationGatewayHttpListener Creates a listener.
New-AzApplicationGatewayRequestRoutingRule Creates a routing rule.
New-AzApplicationGatewaySku Specify the tier and capacity for an application gateway.
New-AzApplicationGatewayWebApplicationFirewallConfiguration Creates the web application firewall configuration.
New-AzApplicationGateway Create an application gateway.
Set-AzVmssStorageProfile Create a storage profile for the scale set.
Set-AzVmssOsProfile Define the operating system for the scale set.
Add-AzVmssNetworkInterfaceConfiguration Define the network interface for the scale set.
New-AzVmss Create a virtual machine scale set.
New-AzStorageAccount Creates a storage account.
Set-AzDiagnosticSetting Configures diagnostics to record data.
Get-AzPublicIPAddress Gets the public IP address of an application gateway.
Remove-AzResourceGroup Removes a resource group and all resources contained within.

Next steps

For more information on the Azure PowerShell module, see Azure PowerShell documentation.

Additional application gateway PowerShell script samples can be found in the Azure Application Gateway documentation.