|
| 1 | +--- |
| 2 | +title: 'Quickstart: Create an Azure Firewall with multiple public IP addresses - Bicep' |
| 3 | +description: In this quickstart, you learn how to use a Bicep file to create an Azure Firewall with multiple public IP addresses. |
| 4 | +services: firewall |
| 5 | +author: mumian |
| 6 | +ms.service: firewall |
| 7 | +ms.topic: quickstart |
| 8 | +ms.custom: subject-armqs, devx-track-azurepowershell, mode-arm |
| 9 | +ms.author: jgao |
| 10 | +ms.date: 08/11/2022 |
| 11 | +--- |
| 12 | + |
| 13 | +# Quickstart: Create an Azure Firewall with multiple public IP addresses - Bicep |
| 14 | + |
| 15 | +In this quickstart, you use a Bicep file to deploy an Azure Firewall with multiple public IP addresses from a public IP address prefix. The deployed firewall has NAT rule collection rules that allow RDP connections to two Windows Server 2019 virtual machines. |
| 16 | + |
| 17 | +[!INCLUDE [About Bicep](../../includes/resource-manager-quickstart-bicep-introduction.md)] |
| 18 | + |
| 19 | +For more information about Azure Firewall with multiple public IP addresses, see [Deploy an Azure Firewall with multiple public IP addresses using Azure PowerShell](deploy-multi-public-ip-powershell.md). |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 24 | + |
| 25 | +## Review the Bicep file |
| 26 | + |
| 27 | +This Bicep file creates an Azure Firewall with two public IP addresses, along with the necessary resources to support the Azure Firewall. |
| 28 | + |
| 29 | +The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/fw-docs-qs). |
| 30 | + |
| 31 | +:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.network/fw-docs-qs/main.bicep"::: |
| 32 | + |
| 33 | +Multiple Azure resources are defined in the template: |
| 34 | + |
| 35 | +- [**Microsoft.Network/networkSecurityGroups**](/azure/templates/microsoft.network/networksecuritygroups) |
| 36 | +- [**Microsoft.Network/publicIPPrefix**](/azure/templates/microsoft.network/publicipprefixes) |
| 37 | +- [**Microsoft.Network/publicIPAddresses**](/azure/templates/microsoft.network/publicipaddresses) |
| 38 | +- [**Microsoft.Network/virtualNetworks**](/azure/templates/microsoft.network/virtualnetworks) |
| 39 | +- [**Microsoft.Compute/virtualMachines**](/azure/templates/microsoft.compute/virtualmachines) |
| 40 | +- [**Microsoft.Storage/storageAccounts**](/azure/templates/microsoft.storage/storageAccounts) |
| 41 | +- [**Microsoft.Network/networkInterfaces**](/azure/templates/microsoft.network/networkinterfaces) |
| 42 | +- [**Microsoft.Network/azureFirewalls**](/azure/templates/microsoft.network/azureFirewalls) |
| 43 | +- [**Microsoft.Network/routeTables**](/azure/templates/microsoft.network/routeTables) |
| 44 | + |
| 45 | +## Deploy the Bicep file |
| 46 | + |
| 47 | +1. Save the Bicep file as **main.bicep** to your local computer. |
| 48 | +1. Deploy the Bicep file using either Azure CLI or Azure PowerShell. |
| 49 | + |
| 50 | + # [CLI](#tab/CLI) |
| 51 | + |
| 52 | + ```azurecli |
| 53 | + az group create --name exampleRG --location eastus |
| 54 | + az deployment group create --resource-group exampleRG --template-file main.bicep --parameters adminUsername=<admin-username> |
| 55 | + ``` |
| 56 | +
|
| 57 | + # [PowerShell](#tab/PowerShell) |
| 58 | +
|
| 59 | + ```azurepowershell |
| 60 | + New-AzResourceGroup -Name exampleRG -Location eastus |
| 61 | + New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -adminUsername "<admin-username>" |
| 62 | + ``` |
| 63 | +
|
| 64 | + --- |
| 65 | +
|
| 66 | + > [!NOTE] |
| 67 | + > Replace **\<admin-username\>** with the admin username for the backend server. |
| 68 | +
|
| 69 | + You will be prompt to enter the admin password. |
| 70 | +
|
| 71 | + When the deployment finishes, you should see a message indicating the deployment succeeded. |
| 72 | +
|
| 73 | +## Validate the deployment |
| 74 | +
|
| 75 | +In the Azure portal, review the deployed resources. Note the firewall public IP addresses. |
| 76 | +
|
| 77 | +Use Remote Desktop Connection to connect to the firewall public IP addresses. Successful connection demonstrates firewall NAT rules that allow the connection to the backend servers. |
| 78 | +
|
| 79 | +## Clean up resources |
| 80 | +
|
| 81 | +When you no longer need the resources that you created with the firewall, delete the resource group. This removes the firewall and all the related resources. |
| 82 | +
|
| 83 | +To delete the resource group, call the `Remove-AzResourceGroup` cmdlet: |
| 84 | +
|
| 85 | +```azurepowershell-interactive |
| 86 | +Remove-AzResourceGroup -Name "exampleRG" |
| 87 | +``` |
| 88 | + |
| 89 | +## Next steps |
| 90 | + |
| 91 | +> [!div class="nextstepaction"] |
| 92 | +> [Tutorial: Deploy and configure Azure Firewall in a hybrid network using the Azure portal](tutorial-hybrid-portal.md) |
0 commit comments