Create a virtual network and subnets

Azure Portal, Hands On10 minutesFreeSteps checked 23 October 2026By Cloud Hands On

In this task you'll create a virtual network with subnets.

A virtual network (VNet) is your own private network in Azure. VMs and other resources inside it can talk to each other on private addresses, and nothing from outside gets in unless you allow it.

You give the VNet a range of private addresses, such as 10.0.0.0/16, and split it into subnets, such as one for web servers and one for databases, so each part can have its own rules.

Example. Larkfield Group's network has 10.20.0.0/16, with a snet-web subnet for its web servers and a snet-data subnet for databases. Only the web subnet accepts traffic from the internet.

Before you start

You need: Network Contributor or Contributor. Time: 10 minutes.

Where to look

  1. Home
  2. Virtual networks
  3. + Create

Steps

  1. Open Virtual networks and select + Create.
  2. Choose rg-portal-practice, name it vnet-practice and pick your region.
  3. On the Security tab, leave Bastion, Azure Firewall and DDoS protection turned off.All three cost money. You'd consider them for real networks.
  4. On the IP addresses tab (called Address space in some forms), keep the address space 10.0.0.0/16.
  5. Edit the default subnet: rename it snet-web and give it 10.0.1.0/24. Then select + Add a subnet and add snet-data with 10.0.2.0/24.Azure keeps five addresses in every subnet for itself, so a /24 gives you 251 usable addresses.
  6. Select Review + create, then Create.
  7. Open the network and select Subnets to check both are there.

Commands

# A network with one subnet
az network vnet create --resource-group rg-portal-practice --name vnet-practice \
  --address-prefix 10.0.0.0/16 --subnet-name snet-web --subnet-prefixes 10.0.1.0/24

# Add a second subnet
az network vnet subnet create --resource-group rg-portal-practice \
  --vnet-name vnet-practice --name snet-data --address-prefixes 10.0.2.0/24

Watch out for

Cost
Virtual networks and subnets are free. Costs come from what you add: gateways, firewalls, Bastion, public IPs and traffic between regions or peered networks.
Security
Plan separate subnets for things that need different rules, such as web servers and databases. Rules are added with network security groups (next task).
Common mistakes
Using an address range that overlaps another network you'll want to connect later, such as your office network or another VNet. Overlapping networks can't be peered or joined by VPN.

Clean up

  1. Resource groups
  2. rg-portal-practice
  3. Delete resource group

Keep the network for the next tasks, then delete the resource group at the end of this section.

Words to know

Address space
The range of private IP addresses a VNet can use, written like 10.0.0.0/16.
Subnet
A slice of the address space for one group of resources.
CIDR
The /16 or /24 notation. A smaller number after the slash means a bigger range: /16 has 65,536 addresses, /24 has 256.

Tick off each step and track your progress in the guide.

Open this task in Azure Portal, Hands On

Keep going