Skip to content

Commit 53d9b8f

Browse files
committed
docs: Reorder sections and update Bastion connection to use SSH key auth
1 parent 249d870 commit 53d9b8f

1 file changed

Lines changed: 96 additions & 80 deletions

File tree

articles/virtual-network/tutorial-connect-virtual-networks.md

Lines changed: 96 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,75 @@ az network vnet subnet create \
209209

210210
---
211211

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:
247+
248+
```azurepowershell-interactive
249+
$subConfig = @{
250+
Name = "subnet-1"
251+
AddressPrefix = "10.1.0.0/24"
252+
VirtualNetwork = $virtualNetwork2
253+
}
254+
$subnetConfig = Add-AzVirtualNetworkSubnetConfig @subConfig
255+
```
256+
257+
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+
212281
## Deploy Azure Bastion
213282

214283
### [Portal](#tab/portal)
@@ -299,75 +368,6 @@ az network bastion create \
299368

300369
---
301370

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:
337-
338-
```azurepowershell-interactive
339-
$subConfig = @{
340-
Name = "subnet-1"
341-
AddressPrefix = "10.1.0.0/24"
342-
VirtualNetwork = $virtualNetwork2
343-
}
344-
$subnetConfig = Add-AzVirtualNetworkSubnetConfig @subConfig
345-
```
346-
347-
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-
371371
## Peer virtual networks
372372

373373
### [Portal](#tab/portal)
@@ -627,19 +627,21 @@ Wait for the virtual machines to be created before continuing with the next step
627627

628628
## Connect to a virtual machine
629629

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.
633631

634-
1. On the **Virtual machines** page, select **vm-1**.
632+
1. In **Virtual machines**, select **vm-1**.
635633

636-
1. In the **Overview** of **vm-1**, select **Connect**.
634+
1. Select **Connect** then **Connect via Bastion** in the **Overview** section.
637635

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:
639637

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. |
641643

642-
1. Enter the username and password you created when you created the virtual machine, then select **Connect**.
644+
1. Select **Connect**.
643645

644646
## Communicate between virtual machines
645647

@@ -660,9 +662,23 @@ Use `ping` to test the communication between the virtual machines. Sign in to th
660662
rtt min/avg/max/mdev = 0.998/1.411/2.292/0.520 ms
661663
```
662664
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. |
664680
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**.
666682
667683
1. At the bash prompt for **vm-2**, enter `ping -c 4 10.0.0.4`.
668684
@@ -677,7 +693,7 @@ Use `ping` to test the communication between the virtual machines. Sign in to th
677693
64 bytes from 10.0.0.4: icmp_seq=4 ttl=64 time=1.28 ms
678694
```
679695
680-
1. Close the Bastion connection to **vm-2**.
696+
1. Close the Bastion session.
681697
682698
### [Portal](#tab/portal)
683699

0 commit comments

Comments
 (0)