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
Copy file name to clipboardExpand all lines: articles/virtual-network/tutorial-connect-virtual-networks.md
+96-80Lines changed: 96 additions & 80 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -209,6 +209,75 @@ az network vnet subnet create \
209
209
210
210
---
211
211
212
+
## Create a second virtual network
213
+
214
+
### [Portal](#tab/portal)
215
+
216
+
Repeat the previous steps to create a second virtual network with the following values:
217
+
218
+
>[!NOTE]
219
+
>The second virtual network can be in the same region as the first virtual network or in a different region. You can skip the Bastion deployment for the second virtual network. After the virtual network peering is established, you can connect to both virtual machines with the same Bastion deployment.
220
+
221
+
| Setting | Value |
222
+
| --- | --- |
223
+
| Name |**vnet-2**|
224
+
| Address space |**10.1.0.0/16**|
225
+
| Resource group |**test-rg**|
226
+
| Subnet name |**subnet-1**|
227
+
| Subnet address range |**10.1.0.0/24**|
228
+
229
+
### [PowerShell](#tab/powershell)
230
+
231
+
Create a second virtual network with [New-AzVirtualNetwork](/powershell/module/az.network/new-azvirtualnetwork). The following example creates a virtual network named **vnet-2** with the address prefix **10.1.0.0/16**.
232
+
233
+
>[!NOTE]
234
+
>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 virtual network peering is established, you can connect to both virtual machines with the same Bastion deployment.
235
+
236
+
```azurepowershell-interactive
237
+
$vnet2 = @{
238
+
ResourceGroupName = "test-rg"
239
+
Location = "EastUS2"
240
+
Name = "vnet-2"
241
+
AddressPrefix = "10.1.0.0/16"
242
+
}
243
+
$virtualNetwork2 = New-AzVirtualNetwork @vnet2
244
+
```
245
+
246
+
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:
Write the subnet configuration to the virtual network with [Set-AzVirtualNetwork](/powershell/module/az.network/Set-azVirtualNetwork), which creates the subnet:
258
+
259
+
```azurepowershell-interactive
260
+
$virtualNetwork2 | Set-AzVirtualNetwork
261
+
```
262
+
263
+
### [CLI](#tab/cli)
264
+
265
+
Create a second virtual network with [az network vnet create](/cli/azure/network/vnet#az-network-vnet-create). The following example creates a virtual network named **vnet-2** with the address prefix **10.1.0.0/16**.
266
+
267
+
>[!NOTE]
268
+
>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 virtual network peering is established, you can connect to both virtual machines with the same Bastion deployment.
269
+
270
+
```azurecli-interactive
271
+
az network vnet create \
272
+
--name vnet-2 \
273
+
--resource-group test-rg \
274
+
--address-prefixes 10.1.0.0/16 \
275
+
--subnet-name subnet-1 \
276
+
--subnet-prefix 10.1.0.0/24
277
+
```
278
+
279
+
---
280
+
212
281
## Deploy Azure Bastion
213
282
214
283
### [Portal](#tab/portal)
@@ -299,75 +368,6 @@ az network bastion create \
299
368
300
369
---
301
370
302
-
## Create a second virtual network
303
-
304
-
### [Portal](#tab/portal)
305
-
306
-
Repeat the previous steps to create a second virtual network with the following values:
307
-
308
-
>[!NOTE]
309
-
>The second virtual network can be in the same region as the first virtual network or in a different region. You can skip the Bastion deployment for the second virtual network. After the virtual network peering is established, you can connect to both virtual machines with the same Bastion deployment.
310
-
311
-
| Setting | Value |
312
-
| --- | --- |
313
-
| Name |**vnet-2**|
314
-
| Address space |**10.1.0.0/16**|
315
-
| Resource group |**test-rg**|
316
-
| Subnet name |**subnet-1**|
317
-
| Subnet address range |**10.1.0.0/24**|
318
-
319
-
### [PowerShell](#tab/powershell)
320
-
321
-
Create a second virtual network with [New-AzVirtualNetwork](/powershell/module/az.network/new-azvirtualnetwork). The following example creates a virtual network named **vnet-2** with the address prefix **10.1.0.0/16**.
322
-
323
-
>[!NOTE]
324
-
>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 virtual network peering is established, you can connect to both virtual machines with the same Bastion deployment.
325
-
326
-
```azurepowershell-interactive
327
-
$vnet2 = @{
328
-
ResourceGroupName = "test-rg"
329
-
Location = "EastUS2"
330
-
Name = "vnet-2"
331
-
AddressPrefix = "10.1.0.0/16"
332
-
}
333
-
$virtualNetwork2 = New-AzVirtualNetwork @vnet2
334
-
```
335
-
336
-
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:
Write the subnet configuration to the virtual network with [Set-AzVirtualNetwork](/powershell/module/az.network/Set-azVirtualNetwork), which creates the subnet:
348
-
349
-
```azurepowershell-interactive
350
-
$virtualNetwork2 | Set-AzVirtualNetwork
351
-
```
352
-
353
-
### [CLI](#tab/cli)
354
-
355
-
Create a second virtual network with [az network vnet create](/cli/azure/network/vnet#az-network-vnet-create). The following example creates a virtual network named **vnet-2** with the address prefix **10.1.0.0/16**.
356
-
357
-
>[!NOTE]
358
-
>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 virtual network peering is established, you can connect to both virtual machines with the same Bastion deployment.
359
-
360
-
```azurecli-interactive
361
-
az network vnet create \
362
-
--name vnet-2 \
363
-
--resource-group test-rg \
364
-
--address-prefixes 10.1.0.0/16 \
365
-
--subnet-name subnet-1 \
366
-
--subnet-prefix 10.1.0.0/24
367
-
```
368
-
369
-
---
370
-
371
371
## Peer virtual networks
372
372
373
373
### [Portal](#tab/portal)
@@ -627,19 +627,21 @@ Wait for the virtual machines to be created before continuing with the next step
627
627
628
628
## Connect to a virtual machine
629
629
630
-
Use `ping` to test the communication between the virtual machines. Sign in to the Azure portal to complete the following steps.
631
-
632
-
1. In the portal, search for and select **Virtual machines**.
630
+
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
633
631
634
-
1.On the **Virtual machines** page, select **vm-1**.
632
+
1.In **Virtual machines**, select **vm-1**.
635
633
636
-
1.In the **Overview**of**vm-1**, select **Connect**.
634
+
1.Select **Connect**then**Connect via Bastion** in the **Overview** section.
637
635
638
-
1. In the **Connect to virtual machine** page, select the **Bastion** tab.
636
+
1. In the **Bastion**connection page, enter or select the following information:
639
637
640
-
1. Select **Use Bastion**.
638
+
| Setting | Value |
639
+
| ------- | ----- |
640
+
| Authentication Type | Select **SSH Private Key from Local File**. |
641
+
| Username | Enter the username you created. |
642
+
| Local File | Select the **vm-1-key** private key file you downloaded. |
641
643
642
-
1.Enter the username and password you created when you created the virtual machine, then select**Connect**.
644
+
1.Select**Connect**.
643
645
644
646
## Communicate between virtual machines
645
647
@@ -660,9 +662,23 @@ Use `ping` to test the communication between the virtual machines. Sign in to th
660
662
rtt min/avg/max/mdev = 0.998/1.411/2.292/0.520 ms
661
663
```
662
664
663
-
1. Close the Bastion connection to **vm-1**.
665
+
1. Close the Bastion session.
666
+
667
+
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
668
+
669
+
1. In **Virtual machines**, select **vm-2**.
670
+
671
+
1. Select **Connect** then **Connect via Bastion** in the **Overview** section.
672
+
673
+
1. In the **Bastion** connection page, enter or select the following information:
674
+
675
+
| Setting | Value |
676
+
| ------- | ----- |
677
+
| Authentication Type | Select **SSH Private Key from Local File**. |
678
+
| Username | Enter the username you created. |
679
+
| Local File | Select the **vm-2-key** private key file you downloaded. |
664
680
665
-
1. Repeat the steps in [Connect to a virtual machine](#connect-to-a-virtual-machine) to connect to **vm-2**.
681
+
1. Select **Connect**.
666
682
667
683
1. At the bash prompt for **vm-2**, enter `ping -c 4 10.0.0.4`.
668
684
@@ -677,7 +693,7 @@ Use `ping` to test the communication between the virtual machines. Sign in to th
677
693
64 bytes from 10.0.0.4: icmp_seq=4 ttl=64 time=1.28 ms
0 commit comments