You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a subnet configuration for Azure Bastion with [Add-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/add-azvirtualnetworksubnetconfig). The following example creates a subnet configuration with a **10.0.1.0/24** address prefix:
Write the subnet configuration to the virtual network with [Set-AzVirtualNetwork](/powershell/module/az.network/Set-azVirtualNetwork), which creates the subnet:
@@ -162,13 +162,13 @@ Create a second virtual network with [New-AzVirtualNetwork](/powershell/module/a
162
162
>The second virtual network can be in the same region as the first virtual network or in a different region. You don't need a Bastion deployment for the second virtual network. After the network peer, you can connect to both virtual machines with the same Bastion deployment.
163
163
164
164
```azurepowershell-interactive
165
-
$vnet1 = @{
165
+
$vnet2 = @{
166
166
ResourceGroupName = "test-rg"
167
167
Location = "EastUS2"
168
168
Name = "vnet-2"
169
169
AddressPrefix = "10.1.0.0/16"
170
170
}
171
-
$virtualNetwork1 = New-AzVirtualNetwork @vnet1
171
+
$virtualNetwork2 = New-AzVirtualNetwork @vnet2
172
172
```
173
173
174
174
Create a subnet configuration with [Add-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/add-azvirtualnetworksubnetconfig). The following example creates a subnet configuration with a **10.1.0.0/24** address prefix:
@@ -177,11 +177,17 @@ Create a subnet configuration with [Add-AzVirtualNetworkSubnetConfig](/powershel
Write the subnet configuration to the virtual network with [Set-AzVirtualNetwork](/powershell/module/az.network/Set-azVirtualNetwork), which creates the subnet:
186
+
187
+
```azurepowershell-interactive
188
+
$virtualNetwork2 | Set-AzVirtualNetwork
189
+
```
190
+
185
191
### [CLI](#tab/cli)
186
192
187
193
---
@@ -257,7 +263,7 @@ Repeat the previous steps to create a second virtual machine in the second virtu
257
263
258
264
### Create the first VM
259
265
260
-
Create a VM with [New-AzVM](/powershell/module/az.compute/new-azvm). The following example creates a VM named **vm-1** in the **vnet-1** virtual network. The `-AsJob` option creates the VM in the background, so you can continue to the next step. When prompted, enter the user name and password for the virtual machine.
266
+
Create a VM with [New-AzVM](/powershell/module/az.compute/new-azvm). The following example creates a VM named **vm-1** in the **vnet-1** virtual network. When prompted, enter the username and password for the virtual machine.
261
267
262
268
```azurepowershell-interactive
263
269
# Create a credential object
@@ -313,7 +319,7 @@ Wait for the virtual machines to be created before continuing with the next step
313
319
314
320
## Connect to a virtual machine
315
321
316
-
Use `ping` to test the communication between the virtual machines.
322
+
Use `ping` to test the communication between the virtual machines. Sign-in to the Azure portal to complete the following steps.
317
323
318
324
1. In the portal, search for and select **Virtual machines**.
319
325
@@ -329,34 +335,38 @@ Use `ping` to test the communication between the virtual machines.
329
335
330
336
## Communicate between VMs
331
337
332
-
1. At the bash prompt for **vm-1**, enter `ping -c 4 vm-2`.
338
+
1. At the bash prompt for **vm-1**, enter `ping -c 4 10.1.0.4`.
333
339
334
340
You get a reply similar to the following message:
335
341
336
342
```output
337
-
azureuser@vm-1:~$ ping -c 4 vm-2
338
-
PING vm-2.3bnkevn3313ujpr5l1kqop4n4d.cx.internal.cloudapp.net (10.1.0.4) 56(84) bytes of data.
339
-
64 bytes from vm-2.internal.cloudapp.net (10.1.0.4): icmp_seq=1 ttl=64 time=1.83 ms
340
-
64 bytes from vm-2.internal.cloudapp.net (10.1.0.4): icmp_seq=2 ttl=64 time=0.987 ms
341
-
64 bytes from vm-2.internal.cloudapp.net (10.1.0.4): icmp_seq=3 ttl=64 time=0.864 ms
342
-
64 bytes from vm-2.internal.cloudapp.net (10.1.0.4): icmp_seq=4 ttl=64 time=0.890 ms
343
+
azureuser@vm-1:~$ ping -c 4 10.1.0.4
344
+
PING 10.1.0.4 (10.1.0.4) 56(84) bytes of data.
345
+
64 bytes from 10.1.0.4: icmp_seq=1 ttl=64 time=2.29 ms
346
+
64 bytes from 10.1.0.4: icmp_seq=2 ttl=64 time=1.06 ms
347
+
64 bytes from 10.1.0.4: icmp_seq=3 ttl=64 time=1.30 ms
348
+
64 bytes from 10.1.0.4: icmp_seq=4 ttl=64 time=0.998 ms
349
+
350
+
--- 10.1.0.4 ping statistics ---
351
+
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
352
+
rtt min/avg/max/mdev = 0.998/1.411/2.292/0.520 ms
343
353
```
344
354
345
355
1. Close the Bastion connection to **vm-1**.
346
356
347
357
1. Repeat the steps in [Connect to a virtual machine](#connect-to-a-virtual-machine) to connect to **vm-2**.
348
358
349
-
1. At the bash prompt for **vm-2**, enter `ping -c 4 vm-1`.
359
+
1. At the bash prompt for **vm-2**, enter `ping -c 4 10.0.0.4`.
350
360
351
361
You get a reply similar to the following message:
352
362
353
363
```output
354
-
azureuser@vm-2:~$ ping -c 4 vm-1
355
-
PING vm-1.3bnkevn3313ujpr5l1kqop4n4d.cx.internal.cloudapp.net (10.0.0.4) 56(84) bytes of data.
356
-
64 bytes from vm-1.internal.cloudapp.net (10.0.0.4): icmp_seq=1 ttl=64 time=0.695 ms
357
-
64 bytes from vm-1.internal.cloudapp.net (10.0.0.4): icmp_seq=2 ttl=64 time=0.896 ms
358
-
64 bytes from vm-1.internal.cloudapp.net (10.0.0.4): icmp_seq=3 ttl=64 time=3.43 ms
359
-
64 bytes from vm-1.internal.cloudapp.net (10.0.0.4): icmp_seq=4 ttl=64 time=0.780 ms
364
+
azureuser@vm-2:~$ ping -c 4 10.0.0.4
365
+
PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
366
+
64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=1.81 ms
367
+
64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=3.35 ms
368
+
64 bytes from 10.0.0.4: icmp_seq=3 ttl=64 time=0.811 ms
369
+
64 bytes from 10.0.0.4: icmp_seq=4 ttl=64 time=1.28 ms
0 commit comments