Azure Virtual Network: subnets, CIDR, public and private IP addressing
Back to the AZ-104 path
AZ-104Chapter 9

Microsoft AZ-104 Certification Study

Azure Virtual Network: subnets, CIDR, public and private IP addressing

Plan isolated Azure networks, divide address spaces into subnets, reserve capacity for services, choose public or private addressing, associate IP resources, and build a peered hub-and-spoke lab.

Suggested study time: 60 minutes • Intermediate • Original rewrite based on the supplied Microsoft Learn module and updated against current Azure networking documentation

Neon Azure administrator shield surrounded by virtual machines, networks, storage, identity, governance, monitoring, backup, and infrastructure as code symbols

1. Design the network before migrating the workload

A healthcare organization is moving applications to Azure. Its administrators need private communication between cloud resources, protected connectivity to the existing datacenter, and an addressing plan that can grow without sacrificing availability. Azure supplies the isolated network boundary; subnets, routes, security controls, and IP resources shape traffic inside and outside that boundary.

This chapter covers the complete decision path from an address space to a working hub-and-spoke laboratory. You will plan virtual networks and subnets, select public or private addresses, associate IP resources, and distinguish source-era behavior from the current Azure platform.

  • Describe Azure features, components, and connection scenarios.
  • Plan nonoverlapping CIDR spaces and service-ready subnets.
  • Choose private or public, dynamic or static IP addressing.
  • Create two virtual networks, configure subnets, and validate peering.
  • Recognize current outbound-access and public-IP SKU requirements.
Azure network study map connecting a virtual network, subnets, private and public IP addresses, security, routing, and peering.
An address plan becomes useful only when routing, security, connectivity, and future growth are designed together.

2. Azure is the private network boundary

Azure , commonly shortened to VNet, is a logically isolated network in Azure. Each VNet has one or more CIDR address prefixes, its own subnets and DNS settings, and Azure-managed routing between its subnets. Resources such as virtual-machine network interfaces receive addresses from a selected subnet.

  • Isolation: a VNet is separated from other virtual networks unless you deliberately connect them.
  • Communication: resources can reach each other, the internet, selected Azure services, or an on-premises network according to the configured path and policy.
  • Scale and availability: virtual networks span availability zones within their Azure region and do not require you to operate physical switches or routers.
  • Extensibility: peering, , , route tables, network virtual appliances, and DNS services let the topology evolve.
A virtual network with two virtual machines connects to an on-premises datacenter, another virtual network, Azure services, and the internet.
The VNet is the isolation boundary; explicit connectivity determines what crosses it.

3. Three common connectivity scenarios

Match the business requirement to the network pattern.
ScenarioDesignTypical use
Cloud-only private networkPlace Azure resources in one or more subnets and expose only the endpoints that need inbound access.A new workload that has no dependency on the datacenter.
Extend the datacenterConnect on-premises and Azure through a site-to-site IPsec VPN or .Migration waves and hybrid operations that require private reachability.
Hybrid applicationKeep a component such as a mainframe, Unix host, or database on-premises while Azure hosts other tiers.Modernization that cannot move every dependency at once.

A point-to-site VPN serves individual clients, while site-to-site VPN and connect networks. Virtual network peering connects VNets over the Microsoft backbone. In every case, address spaces that must communicate must not overlap.

Cloud-only, datacenter-extension, and hybrid-application Azure Virtual Network patterns.
Start with the required communication path, then select VPN, ExpressRoute, or peering.

4. Plan address spaces with CIDR and future growth in mind

A VNet address space is written in Classless Inter-Domain Routing notation, such as 10.1.0.0/16. The prefix length tells how many leading bits describe the network; a shorter prefix contains more addresses. Choose private RFC 1918 ranges for internal resources and maintain one organization-wide inventory for Azure and on-premises networks.

  • Use a unique, nonoverlapping range for every network that may be connected now or later.
  • Leave contiguous capacity for new subnets, service integrations, acquisitions, and regional expansion.
  • Do not assign an on-premises-owned prefix to Azure merely because the networks are not connected yet.
  • Consider routing summaries and operational readability instead of scattering small prefixes without a plan.

Overlapping ranges are the classic blocker for VNet peering, VPN, and ExpressRoute. Renumbering a production network is far more disruptive than reserving suitable space during design.

A 10.1.0.0/16 address space divided into nonoverlapping frontend, backend, and service subnets with room for growth.
The VNet prefix contains every subnet prefix, and no two subnets overlap.

5. Subnets create manageable security and routing boundaries

A subnet is a continuous portion of the VNet address space expressed in CIDR notation. A VNet needs at least one subnet, and every subnet range must be inside the VNet range and unique within that VNet. Separate tiers when they need different security rules, routes, service delegation, or lifecycle ownership.

  • Azure routes traffic between subnets in a VNet by default.
  • A route table with user-defined routes can send traffic through an or another network virtual appliance.
  • Place resources in different subnets when their communication must traverse that inspection point.
  • A subnet can have zero or one network security group; its allow and deny rules filter inbound and outbound flows.
  • Some platform services require a dedicated or delegated subnet and impose naming or minimum-size rules.

6. Azure reserves five addresses in every subnet

Azure does not assign the first four and last address of any subnet to ordinary resources. In 192.168.1.0/24, the unavailable addresses are 192.168.1.0 through 192.168.1.3 and 192.168.1.255.

Reserved addresses in the 192.168.1.0/24 example.
AddressPurpose
192.168.1.0Network address.
192.168.1.1Default gateway reserved by Azure.
192.168.1.2 and 192.168.1.3Reserved for mapping.
192.168.1.255Network broadcast address.

A /29 contains eight total addresses but only three usable addresses after the five reservations. Capacity calculations must also include platform instances, upgrades, scaling, and temporary deployment slots—not only today’s virtual machines.

The five Azure-reserved positions highlighted in a subnet address range.
Always subtract five before estimating the usable capacity of an Azure subnet.

7. Reserve subnets for platform services before they are needed

Representative current service-subnet guidance; verify the service documentation before deployment.
ServiceRequired name or guidancePlanning note
GatewaySubnet; /27 or larger is recommended.Do not deploy ordinary workloads in the gateway subnet.
AzureFirewallSubnet; /26.Reserve enough capacity for scaling.
Azure BastionAzureBastionSubnet; /26 or larger.The exact name is required.
Azure Route ServerRouteServerSubnet; /26.Dedicated subnet for route exchange.
v2Dedicated subnet; /24 recommended.Capacity must accommodate autoscaling and upgrades.
Private Resolver endpointDedicated delegated subnet; /28 minimum.Do not mix endpoint types or unrelated resources.

Requirements can change, and subscription limits are not architectural targets. Check current service limits and subnet requirements rather than copying a portal screenshot or using the smallest technically accepted range.

8. Routing, security, and private service access solve different problems

Do not treat these controls as interchangeable.
ControlPrimary jobDecision question
System and user-defined routesChoose the next hop.Which path should the packet take?
Network security groupAllow or deny traffic by rule.Is this flow permitted?
or network virtual appliancePerform centralized inspection and policy enforcement.Must this flow cross an inspection service?
Expose a supported PaaS, partner, or customer service through a private endpoint.Can the service be reached privately without a public data path?

places a private endpoint in a subnet and keeps service access on the Microsoft network. DNS must resolve the service name to the private endpoint address; connectivity alone does not correct an unresolved or public hostname.

Two application subnets use route tables and network security groups while a private endpoint reaches an Azure service and a firewall inspects selected traffic.
Routing chooses the path, security rules permit the flow, and Private Link changes the service endpoint.

9. Create a virtual network from a complete design

In the Azure portal, create a Virtual network and select its subscription, resource group, name, and region. On IP addresses, enter the planned address space and define at least one subnet. Review security integrations and create the resource only after confirming that the prefixes do not conflict with connected networks.

  • Subscription and resource group establish billing, lifecycle, and access scope.
  • Region establishes where the VNet metadata and regional resources operate.
  • Name should follow the organization’s naming standard.
  • Address space and subnets implement the approved IP plan.
  • DNS, DDoS protection, encryption, service endpoints, delegations, and security integrations are deliberate design choices—not defaults to accept blindly.

10. Private and public IP addresses serve different reachability needs

Choose the address type from the communication requirement.
AddressReachabilityCommon associations
Private IPWithin a VNet and connected networks through peering, , or .VM network interfaces, internal frontends, private frontends, private endpoints.
Public IPInternet-facing endpoint or public Azure service path.VM network interfaces, public , VPN/ExpressRoute gateways, , , , Bastion, Route Server, .

A public IP does not automatically make an application safe or reachable. Standard public IP addresses are closed to inbound traffic by default; an NSG or the associated service policy must explicitly allow the intended flow.

A virtual machine network interface has a private subnet address and an optional public IP while connected networks use the private path.
Private addresses identify resources inside the network; public addresses provide a controlled internet endpoint.

11. Choose static addressing only when identity must remain stable

Dynamic private allocation is the default: Azure selects an available address from the subnet when the resource is created or started. The address is not guaranteed to be the next numeric value and can change after deallocation. Static allocation reserves the chosen unassigned, nonreserved subnet address for the resource.

  • Use static private addresses for DNS servers, domain controllers, appliances, or dependencies that require a stable address.
  • Use static addresses when host records, IP-based TLS certificates, firewall allowlists, or security models depend on a fixed value.
  • Prefer dynamic allocation for ordinary application instances whose identity is supplied by DNS, a load balancer, or service discovery.
  • Configure the static private address through Azure, not only inside the guest operating system, to keep the platform and guest consistent.

In a 10.0.0.0/16 subnet, a selectable static address could be 10.0.0.10 through 10.0.255.254, excluding every address already allocated and the Azure-reserved positions.

12. Public IP resources: current SKU, version, tier, and zones

Create a Public IP address resource by choosing its subscription, resource group, name, region, IP version, SKU, tier, routing preference, and availability-zone behavior. The associated resource must support a compatible SKU and tier.

Current public-IP decisions.
PropertyCurrent behavior
SKUBasic public IP addresses were retired on September 30, 2025. Use Standard public IP resources.
AllocationStandard public IP addresses are static and receive an address when created.
SecurityStandard is secure by default; inbound traffic requires an explicit allow path.
IP versionIPv4 or IPv6 according to the associated service and client requirement. Public IPv4 has a nominal charge; public IPv6 does not.
TierRegional for a regional resource or Global for supported cross-region services; match the associated tier.
Availability zonesChoose zonal, zone-redundant, or nonzonal behavior where the region and resource support it.

Deleting or disassociating the consumer does not always imply the same lifecycle for the standalone public-IP resource. Confirm dependencies and explicitly remove unused billable addresses.

13. Associate public IPs at the correct configuration layer

Where the public IP is attached.
Azure resourceAssociation point
Virtual machine or Network-interface IP configuration.
, gateway, or Gateway IP configuration.
Public , , , Azure Route Server, or Frontend or service IP configuration.
Azure BastionBastion public-IP configuration.

The IP resource and consumer must agree on region, SKU, tier, IP version, and zone capabilities. A mismatch is a design error, not a routing problem.

A public IP resource fans out to network interfaces, gateways, load balancers, application gateways, firewalls, Bastion, Route Server, and API Management.
Associate the public address with the service configuration that owns the internet-facing frontend.

14. Private subnets now require an explicit outbound strategy

The source module predates a platform change. For virtual networks created through APIs after March 31, 2026, new subnets default to private and do not receive implicit default outbound access. The Azure portal had already moved toward this safer default. Existing default outbound access is also not a production availability contract.

  • Use for scalable, predictable outbound SNAT when no inspection service is required.
  • Use an or network virtual appliance with a route table when egress must be centrally inspected.
  • Use a Standard outbound rule when it matches the application architecture.
  • A Standard public IP directly on a network interface is possible for a deliberately internet-addressable instance, but it is rarely the preferred scale pattern.

Private subnet means “no default outbound access”; it does not mean “no possible outbound access.” Select and test an explicit egress path, including DNS, routes, NSG rules, SNAT capacity, monitoring, and failure behavior.

A private subnet reaches the internet through NAT Gateway, Azure Firewall, or a Standard Load Balancer outbound rule.
Current designs make outbound connectivity explicit instead of depending on an implicit platform address.

15. Laboratory architecture: app-vnet and hub-vnet

The supplied exercise migrates a web application into a hub-and-spoke topology. The spoke, app-vnet, contains frontend and backend workloads. The hub, hub-vnet, reserves a subnet for centralized firewall services. Both networks are in the same region and use nonoverlapping ranges so VNet peering can connect them privately.

Laboratory address plan.
NetworkAddress spaceSubnetPrefix
hub-vnet10.0.0.0/16AzureFirewallSubnet10.0.0.0/26
app-vnet10.1.0.0/16frontend10.1.0.0/24
app-vnet10.1.0.0/16backend10.1.1.0/24
app-vnet10.1.0.0/16AzureFirewallSubnet (optional exercise reservation)10.1.63.0/26

The reference architecture also depicts frontend and backend virtual machines, an application security group, a network security group, with private and public addressing, and a Private DNS zone such as privatelink.contoso.com linked to the VNet. Treat these as the target architecture context; the core hands-on task is to create the networks, subnets, and optional peering.

Hub-and-spoke lab with hub-vnet 10.0.0.0/16, app-vnet 10.1.0.0/16, frontend and backend subnets, firewall subnets, VNet peering, virtual machines, and private DNS.
The spoke hosts the application tiers; the hub centralizes shared connectivity and security services.

16. Exercise: create app-vnet and its workload subnets

Allow about 30 minutes and use an Azure subscription where you are authorized to create network resources. Portal labels can evolve, but the address plan remains the source of truth.

  1. Open Virtual networks in the Azure portal and create app-vnet in the chosen resource group and region.
  2. Set the IPv4 address space to 10.1.0.0/16.
  3. Create frontend with 10.1.0.0/24 and backend with 10.1.1.0/24.
  4. Optionally reserve AzureFirewallSubnet as 10.1.63.0/26 if following the complete reference drawing.
  5. Review, create, and inspect Address space and Subnets after deployment.
  6. Confirm that no subnet overlaps and that each usable-address count includes the five Azure reservations.

17. Exercise: create the hub network and peer the VNets

  1. Create hub-vnet in the same region with address space 10.0.0.0/16.
  2. Add AzureFirewallSubnet with prefix 10.0.0.0/26; use the exact reserved name.
  3. From either VNet, add a peering to the other network and create the reciprocal link.
  4. Allow virtual-network access in both directions. Enable forwarded traffic, gateway transit, or remote gateways only when the architecture actually requires them.
  5. Verify both peering links show Connected and that effective routes contain the remote VNet prefixes.
  6. If deploying test VMs, validate private reachability with NSG rules and the operating-system firewall considered.

Peering is not transitive. A spoke peered to a hub does not automatically reach another spoke. Central routing through or another appliance requires user-defined routes and the correct forwarded-traffic settings.

18. Assessment: reason from the requirement

Answers to the nine source-module decisions.
Question focusCorrect decisionReason
Address space for a new VNetUse a unique range that does not overlap on-premises or connected VNets.Overlaps prevent unambiguous routing.
Public-facing Azure serviceUse a public IP or a managed public frontend.Internet clients need a public endpoint.
Datacenter server with stable DNSUse a static private IP.The host record must continue pointing to the same address.
Subnet layoutUse nonoverlapping ranges contained by the VNet.Each address can belong to only one subnet.
Static VM private addressChoose an available address from that VM NIC’s subnet.An address from another subnet is invalid.
DNS server addressStatic.Clients and forwarders depend on a stable destination.
First VNet planning taskDefine the IP address space.Subnets and connectivity depend on it.
Connect on-premises networks over the internetSite-to-site VPN.It creates an encrypted network-to-network tunnel.
Improve segmentation and managementUse subnets.They create routing, security, and service boundaries.

19. Troubleshoot by layer

Common symptoms and the first evidence to inspect.
SymptomCheckLikely correction
Peering cannot be createdBoth VNet and connected-network prefixes.Renumber overlapping spaces.
Private host is unreachableDNS result, effective routes, NSG flow, appliance policy, guest firewall.Fix the first failing layer.
Subnet runs out of addressesUsable capacity, platform reservations, scale and upgrade headroom.Create or resize a suitably planned subnet where supported.
Public service is not reachablePublic-IP association, SKU/zone compatibility, NSG and service listener.Align properties and add only the required inbound rule.
Private subnet has no internet egressNAT/firewall/load-balancer path, route, DNS and SNAT capacity.Configure an explicit outbound method.
Private endpoint resolves publiclyPrivate DNS zone, records, VNet link and resolver path.Correct the DNS integration.

20. AZ-104 traps and platform-era corrections

  • A VNet address space contains its subnets; a subnet does not extend beyond that space.
  • All connected network ranges must be unique and nonoverlapping.
  • Azure reserves five addresses in every subnet, regardless of subnet size.
  • Azure routes between VNet subnets by default; isolation requires an NSG, route design, or inspection control.
  • Dynamic private allocation does not promise the next sequential address.
  • Basic public IP was retired on September 30, 2025; current Standard public IP is static and secure by default.
  • After March 31, 2026, API-created VNet subnets default to private and need explicit outbound access.
  • Peering is private and nontransitive; and solve different connection problems.
  • A static address should be chosen because a dependency requires stability, not as a universal best practice.

21. Compact review of every topic

Use this table as the summarized version of the chapter.
TopicRemember
A regional, logically isolated private network with CIDR space, subnets, DNS, routes, and deliberate connections.
ConnectivityCloud-only, hybrid VPN/ExpressRoute, and peered VNet designs all require nonoverlapping prefixes.
SubnetsContained, nonoverlapping CIDR ranges that create routing, security, delegation, and service boundaries.
CapacitySubtract five reserved addresses and leave room for scaling, upgrades, and dedicated platform subnets.
Private IPUsed inside connected private networks; dynamic is default, static is for stable dependencies.
Public IPUse current Standard resources for deliberate public endpoints; inbound is denied until explicitly allowed.
OutboundPrivate subnets need , firewall/NVA, outbound rules, or another explicit path.
Hub-and-spokePut application tiers in spokes and shared connectivity/security in the hub; add routes and policies explicitly.

22. Summary, active recall, and official resources

Azure supplies an isolated address and routing domain for Azure resources. A sound design starts with unique CIDR ranges, divides them into capacity-aware subnets, reserves service networks, separates route choice from traffic permission, and assigns public or private addresses according to reachability. Current production designs use Standard public IP resources and explicit outbound access rather than retired Basic SKUs or implicit egress.

Active-recall prompts

  • Explain CIDR and subnetting to a nontechnical stakeholder with the 10.1.0.0/16 lab example.
  • Sketch the minimum steps to create a VNet, its subnets, and a peering.
  • Identify which resources in a sample topology truly require a static private or public address.
  • Calculate usable addresses for /24, /27, /28, and /29 subnets after Azure reservations.
  • Explain why a private subnet can still have outbound access and name three explicit egress options.
  • Reproduce the app-vnet and hub-vnet address plan without consulting the table.

Official documentation