title | titleSuffix | description | author | ms.author | ms.date | ms.topic | ms.service | ms.workload | ms.tgt_pltfrm | tags | ms.custom |
---|---|---|---|---|---|---|---|---|---|---|---|
Quickstart: Create a virtual network - Azure portal |
Azure Virtual Network |
In this quickstart, learn how to create a virtual network using the Azure portal. |
mbender-ms |
mbender |
04/13/2022 |
quickstart |
virtual-network |
infrastructure |
virtual-network |
azure-resource-manager |
mode-ui |
In this quickstart, you learn how to create a virtual network using the Azure portal. You deploy two virtual machines (VMs). Next, you securely communicate between VMs and connect to VMs from the internet. A virtual network is the fundamental building block for your private network in Azure. It enables Azure resources, like VMs, to securely communicate with each other and with the internet.
- An Azure account with an active subscription. Create one for free.
Sign in to the Azure portal.
-
Select Create a resource in the upper left-hand corner of the portal.
-
In the search box, enter Virtual Network. Select Virtual Network in the search results.
-
In the Virtual Network page, select Create.
-
In Create virtual network, enter or select this information in the Basics tab:
Setting Value Project details Subscription Select your subscription. Resource group Select Create new.
Enter myResourceGroup.
Select OK.Instance details Name Enter myVNet. Region Select (US) East US. :::image type="content" source="./media/quick-create-portal/create-virtual-network.png" alt-text="Create virtual network Azure portal" border="true":::
-
Select the IP Addresses tab, or select the Next: IP Addresses button at the bottom of the page.
-
In IPv4 address space, select the existing address space and change it to 10.1.0.0/16.
-
Select + Add subnet, then enter MySubnet for Subnet name and 10.1.0.0/24 for Subnet address range.
-
Select Add.
-
Select the Security tab, or select the Next: Security button at the bottom of the page.
-
Under BastionHost, select Enable. Enter this information:
Setting Value Bastion name Enter myBastionHost AzureBastionSubnet address space Enter 10.1.1.0/24 Public IP Address Select Create new.
For Name, enter myBastionIP.
Select OK. -
Select the Review + create tab or select the Review + create button.
-
Select Create.
Create two VMs in the virtual network:
-
On the upper-left side of the portal, select Create a resource > Compute > Virtual machine.
-
In Create a virtual machine, type or select the values in the Basics tab:
Setting Value Project Details Subscription Select your Azure subscription Resource Group Select myResourceGroup Instance details Virtual machine name Enter myVM1 Region Select (US) East US Availability Options Select No infrastructure redundancy required Image Select Windows Server 2019 Datacenter Azure Spot instance Select No Size Choose VM size or take default setting Administrator account Username Enter a username Password Enter a password Confirm password Reenter password Inbound port rules Public inbound ports Select None. |
-
Select the Networking tab, or select Next: Disks, then Next: Networking.
-
In the Networking tab, select or enter:
Setting Value Network interface Virtual network Select myVNet. Subnet Select mySubnet Public IP Select None NIC network security group Select Basic Public inbound ports network Select None. -
Select the Review + create tab, or select the blue Review + create button at the bottom of the page.
-
Review the settings, and then select Create.
-
On the upper-left side of the portal, select Create a resource > Compute > Virtual machine.
-
In Create a virtual machine, type or select the values in the Basics tab:
Setting Value Project Details Subscription Select your Azure subscription Resource Group Select myResourceGroup Instance details Virtual machine name Enter myVM2 Region Select (US) East US Availability Options Select No infrastructure redundancy required Image Select Windows Server 2019 Datacenter Azure Spot instance Select No Size Choose VM size or take default setting Administrator account Username Enter a username Password Enter a password Confirm password Reenter password Inbound port rules Public inbound ports Select None. |
-
Select the Networking tab, or select Next: Disks, then Next: Networking.
-
In the Networking tab, select or enter:
Setting Value Network interface Virtual network Select myVNet. Subnet Select mySubnet Public IP Select None NIC network security group Select Basic Public inbound ports network Select None. -
Select the Review + create tab, or select the blue Review + create button at the bottom of the page.
-
Review the settings, and then select Create.
[!INCLUDE ephemeral-ip-note.md]
-
Go to the Azure portal to manage your private VM. Search for and select Virtual machines.
-
Pick the name of your private virtual machine myVM1.
-
In the VM menu bar, select Connect, then select Bastion.
:::image type="content" source="./media/quick-create-portal/connect-to-virtual-machine.png" alt-text="Connect to myVM1 with Azure Bastion" border="true":::
-
In the Connect page, select the blue Use Bastion button.
-
In the Bastion page, enter the username and password you created for the virtual machine previously.
-
Select Connect.
-
In the Bastion connection of myVM1, open PowerShell.
-
Enter
ping myVM2
.You'll get a reply message like this:
PS C:\Users\myVM1> ping myVM2 Pinging myVM2.ovvzzdcazhbu5iczfvonhg2zrb.bx.internal.cloudapp.net Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for 10.0.0.5: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
The ping fails, because it uses the Internet Control Message Protocol (ICMP). By default, ICMP isn't allowed through your Windows firewall.
-
To allow myVM2 to ping myVM1 in a later step, enter this command:
New-NetFirewallRule –DisplayName "Allow ICMPv4-In" –Protocol ICMPv4
That command lets ICMP inbound through the Windows firewall.
-
Close the Bastion connection to myVM1.
-
Complete the steps in Connect to myVM1, but connect to myVM2.
-
Open PowerShell on myVM2, enter
ping myVM1
.You'll receive a successful reply message like this:
Pinging myVM1.cs4wv3rxdjgedggsfghkjrxuqf.bx.internal.cloudapp.net [10.1.0.4] with 32 bytes of data: Reply from 10.1.0.4: bytes=32 time=1ms TTL=128 Reply from 10.1.0.4: bytes=32 time=1ms TTL=128 Reply from 10.1.0.4: bytes=32 time=1ms TTL=128 Reply from 10.1.0.4: bytes=32 time=1ms TTL=128 Ping statistics for 10.1.0.4: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 1ms, Maximum = 1ms, Average = 1ms
-
Close the bastion connection to myVM2.
In this quickstart, you created a default virtual network and two VMs.
You connected to one VM from the internet and securely communicated between the two VMs.
When you're done using the virtual network and the VMs, delete the resource group and all of the resources it contains:
-
Search for and select myResourceGroup.
-
Select Delete resource group.
-
Enter myResourceGroup for TYPE THE RESOURCE GROUP NAME and select Delete.
To learn more about virtual network settings, see Create, change, or delete a virtual network.
To learn more about types of VM network communications, see Filter network traffic.