Skip to content

Commit 3cef15c

Browse files
authored
Merge pull request #310783 from asudbring/tsk544781-sfi-bastion
Simplify DNAT tutorial to demonstrate HTTP web publishing
2 parents 2acc0de + c171212 commit 3cef15c

1 file changed

Lines changed: 61 additions & 23 deletions

File tree

articles/firewall/tutorial-firewall-dnat-policy.md

Lines changed: 61 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
---
2-
title: 'Tutorial: Filter inbound Internet or intranet traffic with Azure Firewall DNAT policy using the portal'
3-
description: In this tutorial, you learn how to deploy and configure Azure Firewall policy DNAT using the Azure portal.
2+
title: 'Tutorial: Filter inbound Internet traffic with Azure Firewall DNAT policy using the portal'
3+
description: In this tutorial, you learn how to deploy and configure Azure Firewall policy DNAT to publish a web server using the Azure portal.
44
services: firewall
55
author: varunkalyana
66
ms.service: azure-firewall
77
ms.topic: tutorial
8-
ms.date: 05/07/2025
8+
ms.date: 01/22/2026
99
ms.author: varunkalyana
1010
ms.custom: mvc
11-
#Customer intent: As an administrator, I want to deploy and configure Azure Firewall policy DNAT so that I can control inbound Internet access to resources located in a subnet.
12-
# Customer intent: "As a network administrator, I want to deploy and configure a DNAT policy using Azure Firewall, so that I can manage and filter inbound traffic to my virtual network resources effectively."
11+
#Customer intent: As an administrator, I want to deploy and configure Azure Firewall policy DNAT so that I can publish web applications and control inbound Internet access to resources located in a subnet.
1312
---
1413

15-
# Tutorial: Filter inbound Internet or intranet traffic with Azure Firewall policy DNAT using the Azure portal
14+
# Tutorial: Filter inbound Internet traffic with Azure Firewall policy DNAT using the Azure portal
1615

17-
You can configure Azure Firewall policy Destination Network Address Translation (DNAT) to translate and filter inbound internet or intranet traffic to your subnets. When you configure DNAT, the *rule collection action* is set to **DNAT**. Each rule in the NAT rule collection can then be used to translate your firewall public or private IP address and port to a private IP address and port. DNAT rules implicitly add a corresponding network rule to allow the translated traffic. For security reasons, the recommended approach is to add a specific source to allow DNAT access to the network and avoid using wildcards. To learn more about Azure Firewall rule processing logic, see [Azure Firewall rule processing logic](rule-processing.md).
16+
You can configure Azure Firewall policy Destination Network Address Translation (DNAT) to translate and filter inbound internet traffic to your subnets. When you configure DNAT, the *rule collection action* is set to **DNAT**. Each rule in the NAT rule collection can then be used to translate your firewall public IP address and port to a private IP address and port. DNAT rules implicitly add a corresponding network rule to allow the translated traffic. For security reasons, the recommended approach is to add a specific source to allow DNAT access to the network and avoid using wildcards. To learn more about Azure Firewall rule processing logic, see [Azure Firewall rule processing logic](rule-processing.md).
17+
18+
This tutorial demonstrates publishing a web server using DNAT.
1819

1920
In this tutorial, you learn how to:
2021

2122
> [!div class="checklist"]
2223
> * Set up a test network environment
2324
> * Deploy a firewall and policy
2425
> * Create a default route
25-
> * Configure a DNAT rule
26+
> * Deploy and configure a web server
27+
> * Configure a DNAT rule to publish the web server
2628
> * Test the firewall
2729
2830
## Prerequisites
@@ -106,19 +108,25 @@ Now peer the two VNets.
106108
Create a workload virtual machine, and place it in the **SN-Workload** subnet.
107109

108110
1. From the Azure portal menu, select **Create a resource**.
109-
2. Under **Popular**, select **Windows Server 2016 Datacenter**.
111+
2. Under **Popular**, select **Ubuntu Server 22.04 LTS**.
110112

111113
**Basics**
112114

113115
1. For **Subscription**, select your subscription.
114116
1. For **Resource group**, select **RG-DNAT-Test**.
115117
1. For **Virtual machine name**, type **Srv-Workload**.
116118
1. For **Region**, select the same location that you used previously.
117-
1. Type a username and password.
119+
1. For **Image**, select **Ubuntu Server 22.04 LTS - x64 Gen2**.
120+
1. For **Size**, select **Standard_B2s**.
121+
1. For **Authentication type**, select **SSH public key**.
122+
1. For **Username**, type **azureuser**.
123+
1. For **SSH public key source**, select **Generate new key pair**.
124+
1. For **Key pair name**, type **Srv-Workload_key**.
125+
1. Select **None** in **Public inbound ports**.
118126
1. Select **Next: Disks**.
119127

120128
**Disks**
121-
1. Select **Next: Networking**.
129+
- Select **Next: Networking**.
122130

123131
**Networking**
124132

@@ -130,15 +138,40 @@ Create a workload virtual machine, and place it in the **SN-Workload** subnet.
130138

131139
**Management**
132140

141+
- Select **Next: Monitoring**.
142+
143+
**Monitoring**
144+
133145
1. For **Boot diagnostics**, select **Disable**.
134146
1. Select **Review + Create**.
135147

136148
**Review + Create**
137149

138-
Review the summary, and then select **Create**. This will take a few minutes to complete.
150+
Review the summary, and then select **Create**.
151+
152+
- On the **Generate new key pair** dialog, select **Download private key and create resource**. Save the key file as **Srv-Workload_key.pem**.
139153

140154
After deployment finishes, note the private IP address for the virtual machine. It will be used later when you configure the firewall. Select the virtual machine name, and under **Settings**, select **Networking** to find the private IP address.
141155

156+
## Install web server
157+
158+
Use the Azure portal Run Command feature to install a web server on the virtual machine.
159+
160+
1. Navigate to the **Srv-Workload** virtual machine in the Azure portal.
161+
1. Under **Operations**, select **Run command**.
162+
1. Select **RunShellScript**.
163+
1. In the **Run Command Script** window, paste the following script:
164+
165+
```bash
166+
sudo apt-get update
167+
sudo apt-get install -y nginx
168+
echo "<h1>Azure Firewall DNAT Demo - $(hostname)</h1>" | sudo tee /var/www/html/index.html
169+
```
170+
171+
1. Select **Run**.
172+
1. Wait for the script to complete. The output should show successful installation of Nginx.
173+
174+
142175
## Deploy the firewall and policy
143176

144177
1. From the portal home page, select **Create a resource**.
@@ -157,6 +190,7 @@ After deployment finishes, note the private IP address for the virtual machine.
157190
|Choose a virtual network |**Use existing**: VN-Hub|
158191
|Public IP address |**Add new**, Name: **fw-pip**.|
159192

193+
1. Uncheck the box next to **Enable Firewall Management NIC**.
160194
5. Accept the other defaults, and then select **Review + create**.
161195
6. Review the summary, and then select **Create** to create the firewall.
162196

@@ -194,32 +228,36 @@ For the **SN-Workload** subnet, you configure the outbound default route to go t
194228
18. For **Next hop address**, type the private IP address for the firewall that you noted previously.
195229
19. Select **OK**.
196230

197-
## Configure a NAT rule
231+
## Configure a DNAT rule
198232

199-
This rule allows you to connect a remote desktop to the Srv-Workload virtual machine through the firewall.
233+
This rule allows inbound HTTP traffic from the Internet to reach the web server through the firewall.
200234

201235
1. Open the **RG-DNAT-Test** resource group, and select the **fw-dnat-pol** firewall policy.
202236
1. Under **Settings**, select **DNAT rules**.
203237
2. Select **Add a rule collection**.
204-
3. For **Name**, type **rdp**.
238+
3. For **Name**, type **web-access**.
205239
1. For **Priority**, type **200**.
206240
1. For **Rule collection group**, select **DefaultDnatRuleCollectionGroup**.
207-
1. Under **Rules**, for **Name**, type **rdp-nat**.
241+
1. Under **Rules**, for **Name**, type **http-dnat**.
208242
1. For **Source type**, select **IP address**.
209-
1. For **Source**, specify the IP address or range that you want to allow. For example, 192.168.1.0/24.
243+
1. For **Source**, type **\*** to allow traffic from any source.
210244
1. For **Protocol**, select **TCP**.
211-
1. For **Destination Ports**, type **3389**.
245+
1. For **Destination Ports**, type **80**.
212246
1. For **Destination Type**, select **IP Address**.
213-
1. For **Destination**, type the firewall public or private IP address.
247+
1. For **Destination**, type the firewall public IP address.
214248
1. For **Translated address**, type the **Srv-Workload** private IP address.
215-
1. For **Translated port**, type **3389**.
249+
1. For **Translated port**, type **80**.
216250
1. Select **Add**.
217251

218-
219252
## Test the firewall
220253

221-
1. Connect a remote desktop to firewall public IP address. You should be connected to the **Srv-Workload** virtual machine.
222-
2. Close the remote desktop.
254+
Now test the DNAT rule to verify that the web server is accessible through the firewall.
255+
256+
1. Open a web browser.
257+
1. Navigate to `http://<firewall-public-ip>` (use the firewall's public IP address you noted earlier).
258+
1. You should see the web page displaying: **Azure Firewall DNAT Demo - Srv-Workload**
259+
260+
The DNAT rule successfully translates the incoming HTTP request on the firewall's public IP address to the web server's private IP address. This demonstrates how Azure Firewall DNAT can be used to publish web applications while keeping the backend servers in a private subnet.
223261

224262
## Clean up resources
225263

0 commit comments

Comments
 (0)