Skip to content

Files

Latest commit

304ac47 · Apr 14, 2022

History

History
107 lines (71 loc) · 4.05 KB

quick-create-bicep.md

File metadata and controls

107 lines (71 loc) · 4.05 KB
title titleSuffix description services author ms.author ms.date ms.topic ms.service ms.custom
Quickstart: Direct web traffic using Bicep
Azure Application Gateway
In this quickstart, you learn how to use Bicep to create an Azure Application Gateway that directs web traffic to virtual machines in a backend pool.
application-gateway
schaffererin
v-eschaffer
04/14/2022
quickstart
application-gateway
devx-track-azurepowershell, mvc, subject-armqs, mode-arm

Quickstart: Direct web traffic with Azure Application Gateway - Bicep

In this quickstart, you use Bicep to create an Azure Application Gateway. Then you test the application gateway to make sure it works correctly.

[!INCLUDE About Bicep]

Prerequisites

Review the Bicep file

This Bicep file creates a simple setup with a public front-end IP address, 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.

The Bicep file used in this quickstart is from Azure Quickstart Templates

:::code language="bicep" source="~/quickstart-templates/demos/ag-docs-qs/main.bicep":::

Multiple Azure resources are defined in the Bicep file:

Deploy the Bicep file

  1. Save the Bicep file as main.bicep to your local computer.

  2. Deploy the Bicep file using either Azure CLI or Azure PowerShell.

    az group create --name myResourceGroupAG --location eastus
    az deployment group create --resource-group myResourceGroupAG --template-file main.bicep --parameters adminUsername=<admin-username>
    
    New-AzResourceGroup -Name myResourceGroupAG -Location eastus
    New-AzResourceGroupDeployment -ResourceGroupName myResourceGroupAG -TemplateFile ./main.bicep -adminUsername "<admin-username>"
    

    [!NOTE] Replace <admin-username> with the admin username for the backend servers. You'll also be prompted to enter adminPassword.

    When the deployment finishes, you should see a message indicating the deployment succeeded.

Validate the deployment

Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group.

az resource list --resource-group myResourceGroupAG
Get-AzResource -ResourceGroupName myResourceGroupAG

Clean up resources

When no longer needed, use the Azure portal, Azure CLI, or Azure PowerShell to delete the resource group and its resources.

az group delete --name myResourceGroupAG
Remove-AzResourceGroup -Name myResourceGroupAG

Next steps

[!div class="nextstepaction"] Manage web traffic with an application gateway using the Azure CLI