Skip to content

Commit d9c6f63

Browse files
committed
Task 544780: Replace RDP/DNAT with Bastion and SSH
- Changed VM from Windows Server 2019 to Ubuntu 22.04 LTS - Replaced password authentication with SSH keys (Azure-generated) - Removed DNAT rule configuration section - Added Azure Bastion deployment with Developer SKU - Added AzureBastionSubnet (10.0.4.0/26) to virtual network - Updated testing section to use Bastion SSH connection - Replaced Internet Explorer testing with curl commands - Updated checklist to reflect Bastion deployment instead of NAT rule
1 parent a808f8b commit d9c6f63

1 file changed

Lines changed: 59 additions & 27 deletions

File tree

articles/firewall/tutorial-firewall-deploy-portal.md

Lines changed: 59 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ In this article, you learn how to:
4040
> * Create a default route
4141
> * Configure an application rule to allow access to www.google.com
4242
> * Configure a network rule to allow access to external DNS servers
43-
> * Configure a NAT rule to allow a remote desktop to the test server
43+
> * Deploy Azure Bastion for secure VM access
4444
> * Test the firewall
4545
4646
> [!NOTE]
@@ -103,17 +103,20 @@ This virtual network has two subnets.
103103
Now create the workload virtual machine, and place it in the **Workload-SN** subnet.
104104

105105
1. On the Azure portal menu or from the **Home** page, select **Create a resource**.
106-
2. Select **Windows Server 2019 Datacenter**.
106+
2. Select **Ubuntu Server 22.04 LTS**.
107107
4. Enter these values for the virtual machine:
108108

109109
|Setting |Value |
110110
|---------|---------|
111111
|Resource group |**Test-FW-RG**|
112112
|Virtual machine name |**Srv-Work**|
113113
|Region |Same as previous|
114-
|Image|Windows Server 2019 Datacenter|
115-
|Administrator user name |Type a user name|
116-
|Password |Type a password|
114+
|Image|Ubuntu Server 22.04 LTS - x64 Gen2|
115+
|Size|Standard_B2s|
116+
|Authentication type|SSH public key|
117+
|Username |**azureuser**|
118+
|SSH public key source|Generate new key pair|
119+
|Key pair name|**Srv-Work_key**|
117120

118121
4. Under **Inbound port rules**, **Public inbound ports**, select **None**.
119122
6. Accept the other defaults and select **Next: Disks**.
@@ -124,6 +127,7 @@ Now create the workload virtual machine, and place it in the **Workload-SN** sub
124127
1. Accept the defaults and select **Next: Monitoring**.
125128
1. For **Boot diagnostics**, select **Disable** to disable boot diagnostics. Accept the other defaults and select **Review + create**.
126129
1. Review the settings on the summary page, and then select **Create**.
130+
1. On the **Generate new key pair** dialog, select **Download private key and create resource**. Save the key file as **Srv-Work_key.pem**.
127131
1. After the deployment is complete, select **Go to resource** and note the **Srv-Work** private IP address that you'll need to use later.
128132

129133
[!INCLUDE [ephemeral-ip-note.md](~/reusable-content/ce-skilling/azure/includes/ephemeral-ip-note.md)]
@@ -209,24 +213,36 @@ This is the network rule that allows outbound access to two IP addresses at port
209213
1. For **Destination Ports**, type **53**.
210214
2. Select **Add**.
211215

212-
## Configure a DNAT rule
216+
## Deploy Azure Bastion
213217

214-
This rule allows you to connect a remote desktop to the Srv-Work virtual machine through the firewall.
218+
Now deploy Azure Bastion to provide secure access to the virtual machine.
215219

216-
1. Select the **NAT rule collection** tab.
217-
2. Select **Add NAT rule collection**.
218-
3. For **Name**, type **rdp**.
219-
4. For **Priority**, type **200**.
220-
5. Under **Rules**, for **Name**, type **rdp-nat**.
221-
6. For **Protocol**, select **TCP**.
222-
7. For **Source type**, select **IP address**.
223-
8. For **Source**, type **\***.
224-
9. For **Destination address**, type the firewall public IP address.
225-
10. For **Destination Ports**, type **3389**.
226-
11. For **Translated address**, type the Srv-work private IP address.
227-
12. For **Translated port**, type **3389**.
228-
13. Select **Add**.
220+
1. On the Azure portal menu, select **Create a resource**.
221+
1. In the search box, type **Bastion** and select it from the results.
222+
1. Select **Create**.
223+
1. On the **Create a Bastion** page, configure the following settings:
224+
225+
| Setting | Value |
226+
|---------|-------|
227+
| Subscription | Select your subscription |
228+
| Resource group | **Test-FW-RG** |
229+
| Name | **Test-Bastion** |
230+
| Region | Same region as previous resources |
231+
| Tier | **Developer** |
232+
| Virtual network | **Test-FW-VN** |
233+
| Subnet | Select **Manage subnet configuration** |
234+
235+
1. In the **Subnets** page, select **+ Subnet**.
236+
1. Configure the new subnet:
237+
- **Name**: **AzureBastionSubnet** (this name is required)
238+
- **Subnet address range**: **10.0.4.0/26**
239+
1. Select **Save** and close the subnets page.
240+
1. Back on the **Create a Bastion** page, for **Public IP address**, select **Create new**.
241+
1. For **Public IP address name**, type **Bastion-pip**.
242+
1. Select **Review + create**.
243+
1. After validation passes, select **Create**.
229244

245+
The Bastion deployment takes about 10 minutes to complete.
230246

231247
### Change the primary and secondary DNS address for the **Srv-Work** network interface
232248

@@ -244,19 +260,35 @@ For testing purposes, configure the server's primary and secondary DNS addresses
244260

245261
Now, test the firewall to confirm that it works as expected.
246262

247-
1. Connect a remote desktop to the firewall public IP address and sign in to the Srv-Work virtual machine.
248-
1. Open Internet Explorer and browse to `https://www.google.com`.
249-
4. Select **OK** > **Close** on the Internet Explorer security alerts.
263+
1. In the Azure portal, navigate to the **Srv-Work** virtual machine.
264+
1. Select **Connect**, then select **Connect via Bastion**.
265+
1. Select **Use SSH Private Key from Local File**.
266+
1. For **Username**, type **azureuser**.
267+
1. Select the folder icon and browse to the **Srv-Work_key.pem** file you downloaded earlier.
268+
1. Select **Connect**.
269+
1. At the bash prompt, run the following commands to test DNS resolution:
270+
271+
```bash
272+
nslookup www.google.com
273+
nslookup www.microsoft.com
274+
```
275+
276+
Both commands should return answers, showing that your DNS queries are getting through the firewall.
250277

251-
You should see the Google home page.
278+
1. Run the following commands to test the application rule:
252279

253-
5. Browse to `https://www.microsoft.com`.
280+
```bash
281+
curl https://www.google.com
282+
curl https://www.microsoft.com
283+
```
254284

255-
The firewall should block you.
285+
The `www.google.com` request should succeed, and you should see the HTML response.
286+
287+
The `www.microsoft.com` request should fail, showing that the firewall is blocking the request.
256288

257289
So now you verified that the firewall rules are working:
258290

259-
* You can connect to the virtual machine using RDP.
291+
* You can connect to the virtual machine using Bastion and SSH.
260292
* You can browse to the one allowed FQDN, but not to any others.
261293
* You can resolve DNS names using the configured external DNS server.
262294

0 commit comments

Comments
 (0)