Skip to content

Commit 6221663

Browse files
committed
Task 544782: Replace DNAT with Bastion for secure access
- Changed VM from Windows Server 2019 to Ubuntu 22.04 LTS - Replaced password authentication with SSH keys (Azure-generated) - Removed NAT rule collection configuration entirely - Replaced DNAT section with Azure Bastion deployment - Added AzureBastionSubnet (192.168.2.0/26) to VN-Spoke - Deployed Bastion with Developer SKU for secure access - Updated testing section to use Bastion SSH connection - Emphasized security benefits of Bastion over DNAT - Updated article to show modern best practice approach
1 parent ec430c2 commit 6221663

1 file changed

Lines changed: 51 additions & 22 deletions

File tree

articles/firewall/tutorial-firewall-dnat.md

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,20 @@ Now peer the two VNets.
100100
Create a workload virtual machine, and place it in the **SN-Workload** subnet.
101101

102102
1. From the Azure portal menu, select **Create a resource**.
103-
2. Under **Popular Marketplace products**, select **Windows Server 2019 Datacenter**.
103+
2. Under **Popular Marketplace products**, select **Ubuntu Server 22.04 LTS**.
104104

105105
**Basics**
106106

107107
1. For **Subscription**, select your subscription.
108108
2. For **Resource group**, select **RG-DNAT-Test**.
109109
3. For **Virtual machine name**, type **Srv-Workload**.
110110
4. For **Region**, select the same location that you used previously.
111-
5. Type a username and password.
111+
5. For **Image**, select **Ubuntu Server 22.04 LTS - x64 Gen2**.
112+
6. For **Size**, select **Standard_B2s**.
113+
7. For **Authentication type**, select **SSH public key**.
114+
8. For **Username**, type **azureuser**.
115+
9. For **SSH public key source**, select **Generate new key pair**.
116+
10. For **Key pair name**, type **Srv-Workload_key**.
112117
6. Select **Next: Disks**.
113118

114119
**Disks**
@@ -136,6 +141,8 @@ Create a workload virtual machine, and place it in the **SN-Workload** subnet.
136141

137142
Review the summary, and then select **Create**. This process takes a few minutes to complete.
138143

144+
1. On the **Generate new key pair** dialog, select **Download private key and create resource**. Save the key file as **Srv-Workload_key.pem**.
145+
139146
After the deployment finishes, note the private IP address of the virtual machine. You need this IP address later when configuring the firewall. Select the virtual machine name, go to **Overview**, and under **Networking**, note the private IP address.
140147

141148
[!INCLUDE [ephemeral-ip-note.md](~/reusable-content/ce-skilling/azure/includes/ephemeral-ip-note.md)]
@@ -196,29 +203,51 @@ For the **SN-Workload** subnet, configure the outbound default route to go throu
196203
20. For **Next hop address**, type the private IP address of the firewall noted previously.
197204
21. Select **Add**.
198205

199-
## Configure a NAT rule
200-
201-
1. Open the **RG-DNAT-Test** resource group, and select the **FW-DNAT-test** firewall.
202-
2. On the **FW-DNAT-test** page, under **Settings**, select **Rules (classic)**.
203-
3. Select **Add NAT rule collection**.
204-
4. For **Name**, type **RC-DNAT-01**.
205-
5. For **Priority**, type **200**.
206-
6. Under **Rules**, for **Name**, type **RL-01**.
207-
7. For **Protocol**, select **TCP**.
208-
8. For **Source type**, select **IP address**.
209-
9. For **Source**, type *.
210-
10. For **Destination Addresses**, type the firewall's public IP address.
211-
11. For **Destination ports**, type **3389**.
212-
12. For **Translated Address**, type the private IP address of the Srv-Workload virtual machine.
213-
13. For **Translated port**, type **3389**.
214-
14. Select **Add**.
215-
216-
This process takes a few minutes to complete.
206+
## Deploy Azure Bastion for secure access
207+
208+
Azure Bastion provides secure RDP and SSH connectivity to virtual machines without exposing them through DNAT rules.
209+
210+
1. In the **VN-Spoke** virtual network, add the Azure Bastion subnet:
211+
- Navigate to **VN-Spoke** > **Subnets** > **+ Subnet**
212+
- **Name**: **AzureBastionSubnet** (this exact name is required)
213+
- **Starting address**: **192.168.2.0**
214+
- **Subnet size**: **/26 (64 addresses)**
215+
- Select **Save**
216+
217+
1. On the Azure portal menu, select **Create a resource**.
218+
1. Search for **Bastion** and select it.
219+
1. Select **Create**.
220+
1. Configure the Bastion deployment:
221+
222+
| Setting | Value |
223+
|-----------------------|---------------------------------|
224+
| Subscription | Your subscription |
225+
| Resource group | **RG-DNAT-Test** |
226+
| Name | **VN-Spoke-Bastion** |
227+
| Region | Same location as other resources |
228+
| Tier | **Developer** |
229+
| Virtual network | **VN-Spoke** |
230+
| Subnet | **AzureBastionSubnet** (auto-selected) |
231+
| Public IP address | Create new |
232+
| Public IP address name | **Bastion-pip** |
233+
234+
1. Select **Review + create**.
235+
1. Select **Create**.
236+
237+
The deployment process takes approximately 10 minutes to complete.
217238

218239
## Test the firewall
219240

220-
1. Connect a remote desktop to the firewall's public IP address. You should be connected to the **Srv-Workload** virtual machine.
221-
2. Close the remote desktop.
241+
Now test secure connectivity using Azure Bastion.
242+
243+
1. In the Azure portal, navigate to the **Srv-Workload** virtual machine.
244+
1. Select **Connect** > **Connect via Bastion**.
245+
1. Select **Use SSH Private Key from Local File**.
246+
1. For **Username**, type **azureuser**.
247+
1. Browse to and select the **Srv-Workload_key.pem** file you downloaded during VM creation.
248+
1. Select **Connect**.
249+
250+
You should successfully connect to the Srv-Workload virtual machine through Azure Bastion. This provides secure access without exposing the VM through DNAT rules or requiring a public IP address.
222251

223252
## Clean up resources
224253

0 commit comments

Comments
 (0)