|
| 1 | +--- |
| 2 | +title: 'Quickstart: Direct web traffic using a Resource Manager template' |
| 3 | +titleSuffix: Azure Application Gateway |
| 4 | +description: Learn how to use a Resource Manager template to create an Azure Application Gateway that directs web traffic to virtual machines in a backend pool. |
| 5 | +services: application-gateway |
| 6 | +author: vhorne |
| 7 | +ms.service: application-gateway |
| 8 | +ms.topic: quickstart |
| 9 | +ms.date: 03/23/2020 |
| 10 | +ms.author: victorh |
| 11 | +ms.custom: mvc |
| 12 | +--- |
| 13 | + |
| 14 | +# Quickstart: Direct web traffic with Azure Application Gateway - Resource Manager template |
| 15 | + |
| 16 | +In this quickstart, you use a Resource Manager template to create an Azure Application Gateway. Then you test the application gateway to make sure it works correctly. |
| 17 | + |
| 18 | +[!INCLUDE [About Azure Resource Manager](../../includes/resource-manager-quickstart-introduction.md)] |
| 19 | + |
| 20 | +You can also complete this quickstart using the [Azure portal](quick-create-portal.md), [Azure PowerShell](quick-create-powershell.md), or [Azure CLI](quick-create-cli.md). |
| 21 | + |
| 22 | +[!INCLUDE [updated-for-az](../../includes/updated-for-az.md)] |
| 23 | + |
| 24 | +## Prerequisites |
| 25 | + |
| 26 | +- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 27 | + |
| 28 | +## Create an application gateway |
| 29 | + |
| 30 | +For the sake of simplicity, this template creates a simple setup with a public front-end IP, a basic listener to host a single site on the application gateway, a basic request routing rule, and two virtual machines in the backend pool. |
| 31 | + |
| 32 | +### Review the template |
| 33 | + |
| 34 | +The template used in this quickstart is from [Azure Quickstart templates](https://github.com/Azure/azure-quickstart-templates/blob/master/ag-docs-qs/azuredeploy.json) |
| 35 | + |
| 36 | +:::code language="json" source="~/quickstart-templates/ag-docs-qs/azuredeploy.json" range="001-343" highlight="197-297"::: |
| 37 | + |
| 38 | +Multiple Azure resources are defined in the template: |
| 39 | + |
| 40 | +- [**Microsoft.Network/applicationgateways**](/azure/templates/microsoft.network/applicationgateways) |
| 41 | +- [**Microsoft.Network/publicIPAddresses**](/azure/templates/microsoft.network/publicipaddresses) : one for the application gateway, and two for the virtual machines. |
| 42 | +- [**Microsoft.Network/networkSecurityGroups**](/azure/templates/microsoft.network/networksecuritygroups) |
| 43 | +- [**Microsoft.Network/virtualNetworks**](/azure/templates/microsoft.network/virtualnetworks) |
| 44 | +- [**Microsoft.Compute/virtualMachines**](/azure/templates/microsoft.compute/virtualmachines) : two virtual machines |
| 45 | +- [**Microsoft.Network/networkInterfaces**](/azure/templates/microsoft.network/networkinterfaces) : two for the virtual machines |
| 46 | +- [**Microsoft.Compute/virtualMachine/extensions**](/azure/templates/microsoft.compute/virtualmachines/extensions) : to configure IIS and the web pages |
| 47 | + |
| 48 | + |
| 49 | +### Deploy the template |
| 50 | + |
| 51 | +Deploy Resource Manager template to Azure: |
| 52 | + |
| 53 | +1. Select **Deploy to Azure** to sign in to Azure and open the template. The template creates an application gateway, the network infrastructure, and two virtual machines in the backend pool running IIS. |
| 54 | + |
| 55 | + <a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fag-docs-qs%2Fazuredeploy.json"><img src="./media/quick-create-template/deploy-to-azure.png" alt="deploy to azure"/></a> |
| 56 | + |
| 57 | +2. Select or create your resource group, type the virtual machine administrator user name and password. |
| 58 | +3. Select **I agree to the terms and conditions stated above** and then select **Purchase**. The deployment can take 20 minutes or longer to complete. |
| 59 | + |
| 60 | +## Validate the deployment |
| 61 | + |
| 62 | +Although IIS isn't required to create the application gateway, it's installed to verify if Azure successfully created the application gateway. Use IIS to test the application gateway: |
| 63 | + |
| 64 | +1. Find the public IP address for the application gateway on its **Overview** page. Or, you can select **All resources**, enter *myAGPublicIPAddress* in the search box, and then select it in the search results. Azure displays the public IP address on the **Overview** page. |
| 65 | +2. Copy the public IP address, and then paste it into the address bar of your browser to browse that IP address. |
| 66 | +3. Check the response. A valid response verifies that the application gateway was successfully created and can successfully connect with the backend. |
| 67 | + |
| 68 | +  |
| 69 | + |
| 70 | + Refresh the browser multiple times and you should see connections to both myVM1 and myVM2. |
| 71 | + |
| 72 | +## Clean up resources |
| 73 | + |
| 74 | +When you no longer need the resources that you created with the application gateway, delete the resource group. This removes the application gateway and all the related resources. |
| 75 | + |
| 76 | +To delete the resource group, call the `Remove-AzResourceGroup` cmdlet: |
| 77 | + |
| 78 | +```azurepowershell-interactive |
| 79 | +Remove-AzResourceGroup -Name <your resource group name> |
| 80 | +``` |
| 81 | + |
| 82 | +## Next steps |
| 83 | + |
| 84 | +> [!div class="nextstepaction"] |
| 85 | +> [Manage web traffic with an application gateway using the Azure CLI](./tutorial-manage-web-traffic-cli.md) |
0 commit comments