Skip to content

Commit 15ff560

Browse files
authored
Merge pull request #313729 from asudbring/us564739-vnet-modular
Virtual network quickstart — modular content rewrite with placeholders and includes (Portal, PowerShell, CLI)
2 parents d6fef17 + eedea80 commit 15ff560

16 files changed

Lines changed: 718 additions & 425 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: virtual-network
5+
author: asudbring
6+
ms.service: azure-virtual-network
7+
ms.topic: include
8+
ms.date: 03/26/2026
9+
ms.author: allensu
10+
ms.custom: include file
11+
---
12+
13+
When you finish using the virtual network and the virtual machines, use [az group delete](/cli/azure/group#az-group-delete) to remove the resource group and all its resources.
14+
15+
```azurecli-interactive
16+
# Variable declarations
17+
resourceGroupName="test-rg" # <resource-group>
18+
19+
az group delete \
20+
--name $resourceGroupName \
21+
--yes
22+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: virtual-network
5+
author: asudbring
6+
ms.service: azure-virtual-network
7+
ms.topic: include
8+
ms.date: 03/26/2026
9+
ms.author: allensu
10+
ms.custom: include file
11+
---
12+
13+
When you finish using the virtual network and the virtual machines, use [Remove-AzResourceGroup](/powershell/module/az.resources/remove-azresourcegroup) to remove the resource group and all its resources:
14+
15+
```azurepowershell-interactive
16+
# Variable declarations
17+
$resourceGroupName = 'test-rg' # <resource-group>
18+
19+
$rgParams = @{
20+
Name = $resourceGroupName
21+
Force = $true
22+
}
23+
Remove-AzResourceGroup @rgParams
24+
```
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: virtual-network
5+
author: asudbring
6+
ms.service: azure-virtual-network
7+
ms.topic: include
8+
ms.date: 03/26/2026
9+
ms.author: allensu
10+
ms.custom: include file
11+
---
12+
13+
When you finish using the resources that you created, you can delete the resource group and all its resources.
14+
15+
1. In the Azure portal, search for and select **Resource groups**.
16+
17+
1. On the **Resource groups** page, select the **\<resource-group\>** resource group.
18+
19+
1. On the **\<resource-group\>** page, select **Delete resource group**.
20+
21+
1. Enter **\<resource-group\>** in **Enter resource group name to confirm deletion**, and then select **Delete**.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: virtual-network
5+
author: asudbring
6+
ms.service: azure-virtual-network
7+
ms.topic: include
8+
ms.date: 03/26/2026
9+
ms.author: allensu
10+
ms.custom: include file
11+
---
12+
13+
## Create a resource group
14+
15+
Use [az group create](/cli/azure/group#az-group-create) to create a resource group to host the virtual network. Use the following code to create a resource group named **\<resource-group\>** in the **\<region\>** Azure region:
16+
17+
```azurecli-interactive
18+
# Variable declarations
19+
resourceGroupName="test-rg" # <resource-group>
20+
location="eastus2" # <region>
21+
22+
az group create \
23+
--name $resourceGroupName \
24+
--location $location
25+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: virtual-network
5+
author: asudbring
6+
ms.service: azure-virtual-network
7+
ms.topic: include
8+
ms.date: 03/26/2026
9+
ms.author: allensu
10+
ms.custom: include file
11+
---
12+
13+
## Create a resource group
14+
15+
Use [New-AzResourceGroup](/powershell/module/az.Resources/New-azResourceGroup) to create a resource group for the virtual network. Run the following code to create a resource group named **\<resource-group\>** in the **\<region\>** Azure region:
16+
17+
```azurepowershell-interactive
18+
# Variable declarations
19+
$resourceGroupName = 'test-rg' # <resource-group>
20+
$location = 'eastus2' # <region>
21+
22+
$rg = @{
23+
Name = $resourceGroupName
24+
Location = $location
25+
}
26+
New-AzResourceGroup @rg
27+
```
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: virtual-network
5+
author: asudbring
6+
ms.service: azure-virtual-network
7+
ms.topic: include
8+
ms.date: 03/26/2026
9+
ms.author: allensu
10+
ms.custom: include file
11+
---
12+
13+
## Create a resource group
14+
15+
1. Sign in to the [Azure portal](https://portal.azure.com) with your Azure account.
16+
17+
1. In the search box at the top of the portal, enter **Resource group**. Select **Resource groups** in the search results.
18+
19+
1. Select **+ Create**.
20+
21+
1. In the **Basics** tab of **Create a resource group**, enter, or select the following information:
22+
23+
| Setting | Value |
24+
| ------- | ----- |
25+
| Subscription | Select your subscription. |
26+
| Resource group | Enter **\<resource-group\>**. |
27+
| Region | Select **\<region\>**. |
28+
29+
1. Select **Review + create**.
30+
31+
1. Select **Create**.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: virtual-network
5+
author: asudbring
6+
ms.service: azure-virtual-network
7+
ms.topic: include
8+
ms.date: 03/26/2026
9+
ms.author: allensu
10+
ms.custom: include file
11+
---
12+
13+
## Create virtual machines
14+
15+
### Create the first virtual machine
16+
17+
Create a virtual machine with [az vm create](/cli/azure/vm#az-vm-create). The following example creates a virtual machine named **\<virtual-machine-1\>** in the **\<virtual-network\>** virtual network. If SSH keys don't already exist in a default key location, the command creates them. The `--no-wait` option creates the virtual machine in the background, so you can continue to the next step.
18+
19+
```azurecli-interactive
20+
# Variable declarations
21+
resourceGroupName="test-rg" # <resource-group>
22+
vm1Name="vm-1" # <virtual-machine-1>
23+
virtualNetworkName="vnet-1" # <virtual-network>
24+
subnetName="subnet-1" # <subnet>
25+
26+
az vm create \
27+
--resource-group $resourceGroupName \
28+
--name $vm1Name \
29+
--image Ubuntu2204 \
30+
--vnet-name $virtualNetworkName \
31+
--subnet $subnetName \
32+
--public-ip-address "" \
33+
--admin-username azureuser \
34+
--generate-ssh-keys \
35+
--no-wait
36+
```
37+
38+
### Create the second virtual machine
39+
40+
Create a virtual machine named **\<virtual-machine-2\>** in the **\<virtual-network\>** virtual network.
41+
42+
```azurecli-interactive
43+
# Variable declarations
44+
resourceGroupName="test-rg" # <resource-group>
45+
vm2Name="vm-2" # <virtual-machine-2>
46+
virtualNetworkName="vnet-1" # <virtual-network>
47+
subnetName="subnet-1" # <subnet>
48+
49+
az vm create \
50+
--resource-group $resourceGroupName \
51+
--name $vm2Name \
52+
--image Ubuntu2204 \
53+
--vnet-name $virtualNetworkName \
54+
--subnet $subnetName \
55+
--public-ip-address "" \
56+
--admin-username azureuser \
57+
--generate-ssh-keys
58+
```
59+
60+
The virtual machine takes a few minutes to create.
61+
62+
> [!NOTE]
63+
> Virtual machines in a virtual network with a Bastion host don't need public IP addresses. Bastion provides the public IP, and the virtual machines use private IPs to communicate within the network. You can remove the public IPs from any virtual machines in Bastion-hosted virtual networks. For more information, see [Dissociate a public IP address from an Azure VM](~/articles/virtual-network/ip-services/remove-public-ip-address-vm.md).
64+
65+
[!INCLUDE [ephemeral-ip-note.md](~/reusable-content/ce-skilling/azure/includes/ephemeral-ip-note.md)]
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: virtual-network
5+
author: asudbring
6+
ms.service: azure-virtual-network
7+
ms.topic: include
8+
ms.date: 03/26/2026
9+
ms.author: allensu
10+
ms.custom: include file
11+
---
12+
13+
## Create virtual machines
14+
15+
### Create the first virtual machine
16+
17+
Create a virtual machine with [New-AzVM](/powershell/module/az.compute/new-azvm). The following example creates a virtual machine named **\<virtual-machine-1\>** in the **\<virtual-network\>** virtual network.
18+
19+
```azurepowershell-interactive
20+
# Variable declarations
21+
$resourceGroupName = 'test-rg' # <resource-group>
22+
$location = 'eastus2' # <region>
23+
$vm1Name = 'vm-1' # <virtual-machine-1>
24+
$virtualNetworkName = 'vnet-1' # <virtual-network>
25+
$subnetName = 'subnet-1' # <subnet>
26+
27+
# Create a credential object
28+
$cred = Get-Credential
29+
30+
# Define the virtual machine parameters
31+
$vmParams = @{
32+
ResourceGroupName = $resourceGroupName
33+
Location = $location
34+
Name = $vm1Name
35+
Image = "Ubuntu2204"
36+
Size = "Standard_DS1_v2"
37+
Credential = $cred
38+
VirtualNetworkName = $virtualNetworkName
39+
SubnetName = $subnetName
40+
PublicIpAddressName = "" # No public IP address
41+
SshKeyName = "$vm1Name-ssh-key"
42+
GenerateSshKey = $true
43+
}
44+
45+
# Create the virtual machine
46+
New-AzVM @vmParams
47+
```
48+
49+
### Create the second virtual machine
50+
51+
```azurepowershell-interactive
52+
# Variable declarations
53+
$resourceGroupName = 'test-rg' # <resource-group>
54+
$location = 'eastus2' # <region>
55+
$vm2Name = 'vm-2' # <virtual-machine-2>
56+
$virtualNetworkName = 'vnet-1' # <virtual-network>
57+
$subnetName = 'subnet-1' # <subnet>
58+
59+
# Create a credential object
60+
$cred = Get-Credential
61+
62+
# Define the virtual machine parameters
63+
$vmParams = @{
64+
ResourceGroupName = $resourceGroupName
65+
Location = $location
66+
Name = $vm2Name
67+
Image = "Ubuntu2204"
68+
Size = "Standard_DS1_v2"
69+
Credential = $cred
70+
VirtualNetworkName = $virtualNetworkName
71+
SubnetName = $subnetName
72+
PublicIpAddressName = "" # No public IP address
73+
SshKeyName = "$vm2Name-ssh-key"
74+
GenerateSshKey = $true
75+
}
76+
77+
# Create the virtual machine
78+
New-AzVM @vmParams
79+
```
80+
81+
Azure takes a few minutes to create the virtual machines. When Azure finishes creating the virtual machines, it returns the output to PowerShell.
82+
83+
> [!NOTE]
84+
> Virtual machines in a virtual network with a Bastion host don't need public IP addresses. Bastion provides the public IP, and the virtual machines use private IPs to communicate within the network. You can remove the public IPs from any virtual machines in Bastion-hosted virtual networks. For more information, see [Dissociate a public IP address from an Azure Virtual Machine](~/articles/virtual-network/ip-services/remove-public-ip-address-vm.md).
85+
86+
[!INCLUDE [ephemeral-ip-note.md](~/reusable-content/ce-skilling/azure/includes/ephemeral-ip-note.md)]
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: virtual-network
5+
author: asudbring
6+
ms.service: azure-virtual-network
7+
ms.topic: include
8+
ms.date: 03/26/2026
9+
ms.author: allensu
10+
ms.custom: include file
11+
---
12+
13+
## Create virtual machines
14+
15+
The following procedure creates two VMs named **\<virtual-machine-1\>** and **\<virtual-machine-2\>** in the virtual network:
16+
17+
1. In the portal, search for and select **Virtual machines**.
18+
19+
1. In **Virtual machines**, select **+ Create**, and then select **Azure virtual machine**.
20+
21+
1. On the **Basics** tab of **Create a virtual machine**, enter, or select the following information:
22+
23+
| Setting | Value |
24+
|---|---|
25+
| **Project details** | |
26+
| Subscription | Select your subscription. |
27+
| Resource group | Select **\<resource-group\>**. |
28+
| **Instance details** | |
29+
| Virtual machine name | Enter **\<virtual-machine-1\>**. |
30+
| Region | Select **\<region\>**. |
31+
| Availability options | Select **No infrastructure redundancy required**. |
32+
| Security type | Leave the default of **Standard**. |
33+
| Image | Select **Ubuntu Server 22.04 LTS - x64 Gen2**. |
34+
| VM architecture | Leave the default of **x64**. |
35+
| Size | Select a size. |
36+
| **Administrator account** | |
37+
| Authentication type | Select **SSH public key**. |
38+
| Username | Enter **azureuser**. |
39+
| SSH public key source | Select **Generate new key pair**. |
40+
| Key pair name | Enter **\<virtual-machine-1\>-key**. |
41+
| **Inbound port rules** | |
42+
| Public inbound ports | Select **None**. |
43+
44+
1. Select the **Networking** tab. Enter or select the following information:
45+
46+
| Setting | Value |
47+
|---|---|
48+
| **Network interface** | |
49+
| Virtual network | Select **\<virtual-network\>**. |
50+
| Subnet | Select **\<subnet\> (10.0.0.0/24)**. |
51+
| Public IP | Select **None**. |
52+
| NIC network security group | Select **Advanced**. |
53+
| Configure network security group | Select **Create new**.</br> Enter **\<network-security-group\>** for the name.</br> Leave the rest at the defaults and select **OK**. |
54+
55+
1. Leave the rest of the settings at the defaults and select **Review + create**.
56+
57+
1. Review the settings and select **Create**.
58+
59+
1. Wait for the first virtual machine to deploy then repeat the previous steps to create a second virtual machine with the following settings:
60+
61+
| Setting | Value |
62+
|---|---|
63+
| Virtual machine name | Enter **\<virtual-machine-2\>**. |
64+
| SSH public key source | Select **Generate new key pair**. |
65+
| Key pair name | Enter **\<virtual-machine-2\>-key**. |
66+
| Virtual network | Select **\<virtual-network\>**. |
67+
| Subnet | Select **\<subnet\> (10.0.0.0/24)**. |
68+
| Public IP | Select **None**. |
69+
| NIC network security group | Select **Advanced**. |
70+
| Configure network security group | Select **\<network-security-group\>**. |
71+
72+
> [!NOTE]
73+
> Virtual machines in a virtual network with an Azure Bastion host don't need public IP addresses. Bastion provides the public IP, and the VMs use private IPs to communicate within the network. You can remove the public IPs from any VMs in Bastion-hosted virtual networks. For more information, see [Dissociate a public IP address from an Azure VM](~/articles/virtual-network/ip-services/remove-public-ip-address-vm.md).
74+
75+
[!INCLUDE [ephemeral-ip-note.md](~/reusable-content/ce-skilling/azure/includes/ephemeral-ip-note.md)]

0 commit comments

Comments
 (0)