Azure Virtual Network Subnets

This document provides a comprehensive guide to understanding and managing subnets within Azure Virtual Networks (VNets).

What are Subnets?

Subnets are a logical division of an Azure Virtual Network (VNet). By dividing a VNet into subnets, you can segment the VNet into smaller network segments. Each subnet is a range of IP addresses within the VNet's address space. You can then associate network security groups (NSGs) and route tables to subnets.

Benefits of Using Subnets

Creating and Managing Subnets

Subnets are created within a VNet. Each VNet must have at least one subnet. When you create a subnet, you define its name, address range, and optionally associate it with a Network Security Group (NSG) and a Route Table.

Key Properties of a Subnet:

Important: The address range of a subnet must be a subset of the VNet's address space. Once a subnet is created, its address range cannot be changed.

IP Addressing within Subnets

Each subnet is assigned a block of IP addresses from the VNet's address space. Azure reserves the first four IP addresses and the last IP address in every subnet for internal use:

This means that for a subnet with a /24 prefix (256 addresses), only 251 addresses are available for your resources.

Tip: Plan your subnet IP address ranges carefully to accommodate future growth and ensure efficient IP address utilization. Consider creating smaller subnets for specific services.

Example Subnet Configuration

Consider a VNet with an address space of 10.0.0.0/16. You could create the following subnets:

Diagram showing Azure VNet with multiple subnets
Conceptual diagram of a VNet with segmented subnets.

Subnet Delegation

Subnet delegation allows you to designate a specific Azure service to consume resources within a subnet. When a subnet is delegated to a service, it means that the service will manage the IP addresses within that subnet for its own resources. This simplifies the deployment and management of certain services.

Examples of services that can be delegated include Azure App Service, Azure Kubernetes Service (AKS), and Azure SQL Database.

Next Steps

Now that you understand subnets, you can explore how to:

Back to Virtual Networks Learn about Network Security Groups