Skip to content

Commit 1210bb6

Browse files
asudbringCopilot
andcommitted
Add Bastion Basic for secure VM access
Co-authored-by: Copilot <[email protected]>
1 parent 65b4029 commit 1210bb6

1 file changed

Lines changed: 53 additions & 11 deletions

File tree

articles/dns/private-dns-getstarted-cli.md

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: dns
55
author: asudbring
66
ms.service: azure-dns
77
ms.topic: quickstart
8-
ms.date: 11/30/2023
8+
ms.date: 07/11/2025
99
ms.author: allensu
1010
ms.custom:
1111
- devx-track-azurecli
@@ -52,6 +52,12 @@ az network vnet create \
5252
--subnet-name backendSubnet \
5353
--subnet-prefixes 10.2.0.0/24
5454
55+
az network vnet subnet create \
56+
--vnet-name myAzureVNet \
57+
--resource-group MyAzureResourceGroup \
58+
--name AzureBastionSubnet \
59+
--address-prefix 10.2.1.0/24
60+
5561
az network private-dns zone create -g MyAzureResourceGroup \
5662
-n private.contoso.com
5763
@@ -78,6 +84,37 @@ Omitting the resource group lists all zones in the subscription:
7884
az network private-dns zone list
7985
```
8086

87+
## Deploy Azure Bastion
88+
89+
Azure Bastion uses your browser to connect to VMs in your virtual network over secure shell (SSH) or remote desktop protocol (RDP) by using their private IP addresses. The VMs don't need public IP addresses, client software, or special configuration. For more information about Azure Bastion, see [Azure Bastion](/azure/bastion/bastion-overview).
90+
91+
> [!NOTE]
92+
> [!INCLUDE [Pricing](~/reusable-content/ce-skilling/azure/includes/bastion-pricing.md)]
93+
94+
Create a public IP address for the Azure Bastion host with [az network public-ip create](/cli/azure/network/public-ip).
95+
96+
```azurecli
97+
az network public-ip create \
98+
--resource-group MyAzureResourceGroup \
99+
--name public-ip-bastion \
100+
--location eastus \
101+
--allocation-method Static \
102+
--sku Standard
103+
```
104+
105+
Create an Azure Bastion host with [az network bastion create](/cli/azure/network/bastion). Azure Bastion is used to securely connect to the virtual machines without exposing them to the public internet.
106+
107+
```azurecli
108+
az network bastion create \
109+
--resource-group MyAzureResourceGroup \
110+
--name bastion \
111+
--vnet-name myAzureVNet \
112+
--public-ip-address public-ip-bastion \
113+
--location eastus \
114+
--sku Basic \
115+
--no-wait
116+
```
117+
81118
## Create the test virtual machines
82119

83120
Now, create two virtual machines so you can test your private DNS zone:
@@ -90,9 +127,8 @@ az vm create \
90127
-l eastus \
91128
--subnet backendSubnet \
92129
--vnet-name myAzureVnet \
93-
--nsg NSG01 \
94-
--nsg-rule RDP \
95-
--image win2016datacenter
130+
--image win2016datacenter \
131+
--public-ip-address ""
96132
```
97133

98134
```azurecli
@@ -103,9 +139,8 @@ az vm create \
103139
-l eastus \
104140
--subnet backendSubnet \
105141
--vnet-name myAzureVnet \
106-
--nsg NSG01 \
107-
--nsg-rule RDP \
108-
--image win2016datacenter
142+
--image win2016datacenter \
143+
--public-ip-address ""
109144
```
110145

111146
Creating a virtual machine will take a few minutes to complete.
@@ -142,18 +177,25 @@ Now you can test the name resolution for your **private.contoso.com** private zo
142177

143178
You can use the ping command to test name resolution. So, configure the firewall on both virtual machines to allow inbound ICMP packets.
144179

145-
1. Connect to myVM01, and open a Windows PowerShell window with administrator privileges.
146-
2. Run the following command:
180+
1. In the [Azure portal](https://portal.azure.com), search for and select **Virtual machines**.
181+
182+
1. Select **myVM01**.
183+
184+
1. In **Overview**, select **Connect** > **Connect via Bastion**.
185+
186+
1. Enter the username and password you created when you deployed the virtual machine, then select **Connect**.
187+
188+
1. Open a Windows PowerShell window and run the following command:
147189

148190
```powershell
149191
New-NetFirewallRule –DisplayName "Allow ICMPv4-In" –Protocol ICMPv4
150192
```
151193

152-
Repeat for myVM02.
194+
1. Close the Bastion connection to **myVM01** and repeat the previous steps to connect to **myVM02**.
153195

154196
### Ping the VMs by name
155197

156-
1. From the myVM02 Windows PowerShell command prompt, ping myVM01 using the automatically registered host name:
198+
1. From the **myVM02** Bastion connection, open a Windows PowerShell command prompt and ping myVM01 using the automatically registered host name:
157199

158200
```powershell
159201
ping myVM01.private.contoso.com

0 commit comments

Comments
 (0)