Virtual networks, subnets and public IPs
Build a VNet the way an administrator does: address space, subnets, NICs, private and public IPs, and outbound access.
In this lesson you'll learn
- What a VNet is and what lives inside it
- How private IPs are assigned, and the right way to make one static
- Public IP SKUs and why Standard is the only real choice now
- How VMs reach the internet now that default outbound access is retiring
1. The building blocks
New to Azure networking? Start here
A virtual network (VNet) is your own private network inside an Azure region. Think of it as the office building. Subnets are the floors, used to separate things like web servers from databases. Every VM plugs in through a network interface (NIC), which is the network card that holds its IP addresses.
A VNet lives in one region and one subscription. Resources in the same VNet can talk to each other by default, even across subnets.
2. Create a VNet
In the portal: Virtual networks > Create. The Basics tab sets subscription, resource group, name and region. The IP addresses tab sets the address space and subnets. The Security tab can add Bastion, Azure Firewall and DDoS protection at the same time.
az network vnet create \\ --resource-group rg-sskaiser \\ --name sskaiser-vnet \\ --address-prefixes 10.20.0.0/16 \\ --subnet-name web --subnet-prefixes 10.20.0.0/25 az network vnet subnet create -g rg-sskaiser \\ --vnet-name sskaiser-vnet -n app --address-prefixes 10.20.0.128/25
Exam focus
Use private ranges from RFC 1918: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. You can add more address ranges to a VNet later. A subnet's range can only be changed if nothing in it would end up outside the new range.
3. Private IP addresses
Azure assigns private IPs from the subnet through its own DHCP. By default the assignment is dynamic, but in practice the address only changes if the VM is deleted or moved. For servers that others reach by IP, such as DNS servers or domain controllers, set the assignment to static.
az network nic ip-config update -g rg-sskaiser \\ --nic-name web-vm1-nic -n ipconfig1 \\ --private-ip-address 10.20.0.10
Example
SS Kaiser's legacy order service calls its stock service by a hard-coded IP. After migration, the stock VM was restarted and kept its IP. Months later it was redeployed from backup and came up on a new address, and orders failed for an hour. A static assignment on the NIC would have prevented this.
4. Public IP addresses
A public IP is a separate Azure resource that you attach to a NIC, a load balancer, a VPN gateway, Bastion, a NAT gateway or Application Gateway.
| Item | Standard SKU | Basic SKU |
|---|---|---|
| Status | Current | Retired 30 September 2025 |
| Allocation | Always static | Static or dynamic |
| Security | Closed by default, needs an NSG to allow traffic | Open by default |
| Zones | Zonal or zone-redundant | No zone support |
| Works with | Standard load balancer | Basic load balancer only |
- DNS name label: gives the IP a name like sskaiser.uksouth.cloudapp.azure.com.
- Public IP prefix: reserves a contiguous block of static public IPs, useful when partners allow-list your addresses.
- Load balancer and public IP SKUs must match. A Standard load balancer needs Standard IPs.
5. Getting out to the internet
Historically, VMs without a public IP could still reach the internet through a hidden "default outbound access" address. Microsoft is retiring this for new deployments, so plan an explicit outbound method:
| Option | Best for |
|---|---|
| NAT gateway on the subnet | The recommended choice. It gives scalable outbound connections for a whole subnet, with no inbound exposure. |
| Load balancer outbound rules | VMs already behind a Standard public load balancer. |
| Public IP on the NIC | A single VM that also needs inbound access. |
| Azure Firewall or an NVA with a UDR | Organisations that must inspect and log all outbound traffic. |
Exam traps to remember
- A VM's NICs must all be in the same VNet. To move a VM to another VNet, recreate it from its disks.
- A NIC can be in a different subnet of the same VNet, and you can change its subnet while the VM is stopped.
- Standard public IPs are always static and deny inbound traffic until an NSG allows it.
- The number of NICs a VM can have depends on its size.
Test yourself: 3 check questions and exam-style practice questions on this topic are in the AZ-104 Azure Administrator app.
Practise in the app