|
| 1 | +--- |
| 2 | +title: 'Quickstart: Create an Azure Virtual Network' |
| 3 | +description: Learn how to use the various deployment methods in Azure to create a virtual network. |
| 4 | +author: asudbring |
| 5 | +ms.author: allensu |
| 6 | +ms.service: azure-virtual-network |
| 7 | +ms.topic: quickstart #Don't change |
| 8 | +ms.date: 04/22/2025 |
| 9 | + |
| 10 | +#customer intent: As an administrator or network engineer, I want to create a virtual network and test traffic between virtual machines in the same virtual network. |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +# Quickstart: Create an Azure Virtual Network |
| 15 | + |
| 16 | +In this quickstart, learn how to create an Azure Virtual Network (VNet) using the Azure portal, Azure CLI, Azure PowerShell, Resource Manager template, Bicep template, and Terraform. Two virtual machines and an Azure Bastion host are deployed to test connectivity between the virtual machines in the same virtual network. The Azure Bastion host facilitates secure and seamless RDP and SSH connectivity to the virtual machines directly in the Azure portal over SSL. |
| 17 | + |
| 18 | +:::image type="content" source="./media/quick-create-portal/virtual-network-qs-resources.png" alt-text="Diagram of resources created in the virtual network quickstart." lightbox="./media/quick-create-portal/virtual-network-qs-resources.png"::: |
| 19 | + |
| 20 | +A virtual network is the fundamental building block for private networks in Azure. Azure Virtual Network enables Azure resources like VMs to securely communicate with each other and the internet. |
| 21 | + |
| 22 | +>[!VIDEO https://learn-video.azurefd.net/vod/player?id=6b5b138e-8406-406e-8b34-40bdadf9fc6d] |
| 23 | +
|
| 24 | +If you don't have a service subscription, [create a free trial account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 25 | + |
| 26 | +## Prerequisites |
| 27 | + |
| 28 | +### [Portal](#tab/portal) |
| 29 | + |
| 30 | +- An Azure account with an active subscription. You can [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 31 | + |
| 32 | +### [Powershell](#tab/powershell) |
| 33 | + |
| 34 | +- An Azure account with an active subscription. You can [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 35 | + |
| 36 | +[!INCLUDE [cloud-shell-try-it.md](~/reusable-content/ce-skilling/azure/includes/cloud-shell-try-it.md)] |
| 37 | + |
| 38 | +If you choose to install and use PowerShell locally, this article requires the Azure PowerShell module version 1.0.0 or later. Run `Get-Module -ListAvailable Az` to find the installed version. If you need to upgrade, see [Install Azure PowerShell module](/powershell/azure/install-azure-powershell). If you're running PowerShell locally, you also need to run `Connect-AzAccount` to create a connection with Azure. |
| 39 | + |
| 40 | +### [CLI](#tab/cli) |
| 41 | + |
| 42 | +[!INCLUDE [quickstarts-free-trial-note](~/reusable-content/ce-skilling/azure/includes/quickstarts-free-trial-note.md)] |
| 43 | + |
| 44 | +[!INCLUDE [azure-cli-prepare-your-environment-no-header.md](~/reusable-content/azure-cli/azure-cli-prepare-your-environment-no-header.md)] |
| 45 | + |
| 46 | +- This article requires version 2.0.28 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed. |
| 47 | + |
| 48 | +### [ARM](#tab/arm) |
| 49 | + |
| 50 | +- An Azure account with an active subscription. You can [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 51 | + |
| 52 | +### [Bicep](#tab/bicep) |
| 53 | + |
| 54 | +- An Azure account with an active subscription. You can [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 55 | + |
| 56 | +- To deploy the Bicep files, either the Azure CLI or Azure PowerShell installed. |
| 57 | + |
| 58 | +### [Terraform](#tab/terraform) |
| 59 | + |
| 60 | +- An Azure account with an active subscription. You can [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 61 | + |
| 62 | +- [Installation and configuration of Terraform](/azure/developer/terraform/quickstart-configure). |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | + |
| 67 | +### [Portal](#tab/portal) |
| 68 | + |
| 69 | +## <a name="create-a-virtual-network"></a> Sign in to Azure |
| 70 | + |
| 71 | +Sign in to the [Azure portal](https://portal.azure.com) with your Azure account. |
| 72 | + |
| 73 | +[!INCLUDE [virtual-network-create-with-bastion.md](~/reusable-content/ce-skilling/azure/includes/virtual-network-create-with-bastion.md)] |
| 74 | + |
| 75 | +[!INCLUDE [create-two-virtual-machines.md](../../includes/create-two-virtual-machines.md)] |
| 76 | + |
| 77 | +## Connect to a virtual machine |
| 78 | + |
| 79 | +1. In the portal, search for and select **Virtual machines**. |
| 80 | + |
| 81 | +1. On the **Virtual machines** page, select **vm-1**. |
| 82 | + |
| 83 | +1. In the **Overview** information for **vm-1**, select **Connect**. |
| 84 | + |
| 85 | +1. On the **Connect to virtual machine** page, select the **Bastion** tab. |
| 86 | + |
| 87 | +1. Select **Use Bastion**. |
| 88 | + |
| 89 | +1. Enter the username and password that you created when you created the VM, and then select **Connect**. |
| 90 | + |
| 91 | +## Start communication between VMs |
| 92 | + |
| 93 | +1. At the bash prompt for **vm-1**, enter `ping -c 4 vm-2`. |
| 94 | + |
| 95 | + You get a reply similar to the following message: |
| 96 | + |
| 97 | + ```output |
| 98 | + azureuser@vm-1:~$ ping -c 4 vm-2 |
| 99 | + PING vm-2.3bnkevn3313ujpr5l1kqop4n4d.cx.internal.cloudapp.net (10.0.0.5) 56(84) bytes of data. |
| 100 | + 64 bytes from vm-2.internal.cloudapp.net (10.0.0.5): icmp_seq=1 ttl=64 time=1.83 ms |
| 101 | + 64 bytes from vm-2.internal.cloudapp.net (10.0.0.5): icmp_seq=2 ttl=64 time=0.987 ms |
| 102 | + 64 bytes from vm-2.internal.cloudapp.net (10.0.0.5): icmp_seq=3 ttl=64 time=0.864 ms |
| 103 | + 64 bytes from vm-2.internal.cloudapp.net (10.0.0.5): icmp_seq=4 ttl=64 time=0.890 ms |
| 104 | + ``` |
| 105 | +
|
| 106 | +1. Close the Bastion connection to **vm-1**. |
| 107 | +
|
| 108 | +1. Repeat the steps in [Connect to a virtual machine](#connect-to-a-virtual-machine) to connect to **vm-2**. |
| 109 | +
|
| 110 | +1. At the bash prompt for **vm-2**, enter `ping -c 4 vm-1`. |
| 111 | +
|
| 112 | + You get a reply similar to the following message: |
| 113 | +
|
| 114 | + ```output |
| 115 | + azureuser@vm-2:~$ ping -c 4 vm-1 |
| 116 | + PING vm-1.3bnkevn3313ujpr5l1kqop4n4d.cx.internal.cloudapp.net (10.0.0.4) 56(84) bytes of data. |
| 117 | + 64 bytes from vm-1.internal.cloudapp.net (10.0.0.4): icmp_seq=1 ttl=64 time=0.695 ms |
| 118 | + 64 bytes from vm-1.internal.cloudapp.net (10.0.0.4): icmp_seq=2 ttl=64 time=0.896 ms |
| 119 | + 64 bytes from vm-1.internal.cloudapp.net (10.0.0.4): icmp_seq=3 ttl=64 time=3.43 ms |
| 120 | + 64 bytes from vm-1.internal.cloudapp.net (10.0.0.4): icmp_seq=4 ttl=64 time=0.780 ms |
| 121 | + ``` |
| 122 | +
|
| 123 | +1. Close the Bastion connection to **vm-2**. |
| 124 | +
|
| 125 | +[!INCLUDE [portal-clean-up.md](~/reusable-content/ce-skilling/azure/includes/portal-clean-up.md)] |
| 126 | +
|
| 127 | +
|
| 128 | +### [Powershell](#tab/powershell) |
| 129 | +
|
| 130 | +### [CLI](#tab/cli) |
| 131 | +
|
| 132 | +### [ARM](#tab/arm) |
| 133 | +
|
| 134 | +### [Bicep](#tab/bicep) |
| 135 | +
|
| 136 | +### [Terraform](#tab/terraform) |
| 137 | +
|
| 138 | +--- |
| 139 | +
|
| 140 | +
|
| 141 | +## Clean up resources |
| 142 | +
|
| 143 | +
|
| 144 | +
|
| 145 | +## Next step -or- Related content |
| 146 | +
|
| 147 | +> [!div class="nextstepaction"] |
| 148 | +> [Next sequential article title](link.md) |
| 149 | +
|
| 150 | +-or- |
| 151 | +
|
| 152 | +- [Related article title](link.md) |
| 153 | +- [Related article title](link.md) |
| 154 | +- [Related article title](link.md) |
| 155 | +
|
0 commit comments