IP Addressing
Address spaces · subnets · service subnets · delegation · public IPs · public IP prefixes · custom IP prefixes (BYOIP)
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
Virtual network and address space
| Topic | What the page says |
|---|---|
| Scope | A VNet is scoped to one region and one subscription. Peering connects VNets in different regions or subscriptions. VNets and subnets span all availability zones of the region. |
| Address space | One or more non-overlapping ranges in CIDR notation. The range can be public or private (RFC 1918), but Microsoft recommends 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. The RFC 6598 range 100.64.0.0/10 is treated as private in Azure. |
| Ranges you can't add | 224.0.0.0/4 (multicast), 255.255.255.255/32 (broadcast), 127.0.0.0/8 (loopback), 169.254.0.0/16 (link local), 168.63.129.16/32 (internal DNS). |
| Overlap | VNets with ranges that overlap another VNet or an on-premises network can't be connected. Plan the ranges before you build. |
| Change later | You can add, remove and modify the CIDR blocks. You can shrink a range only while it still includes every subnet. You can't remove a range that contains a subnet. On a peered or connected VNet the new range can't overlap the peer or on-premises range. |
| Names | You can't change the name of a VNet or of a subnet after creation. |
| Cost | There's no charge for Azure Virtual Network itself. |
Limits per region and subscription
| Resource | Limit |
|---|---|
| Virtual networks | 1,000 |
| Subnets per virtual network | 3,000 |
| Private IP addresses per virtual network | 65,536 |
| DNS servers per virtual network | 20 |
- Design advice: don't let subnets cover the whole address space, reserve room for growth, and use a few large VNets instead of many small ones.
- A VNet is a Layer 3 overlay. Azure doesn't support Layer 2 semantics, so you can't bring VLANs.
- VNets can be IPv4 only or dual stack (IPv4 + IPv6). An IPv6 subnet must be exactly
/64. - To move a VM to another VNet you must delete and recreate the VM; the disks can be kept.
Subnet rules
| Rule | Detail |
|---|---|
| Size | Smallest IPv4 subnet /29, largest /2. |
| Reserved addresses | Azure reserves 5 per subnet: the first four and the last. In 192.168.1.0/24: .0 network, .1 default gateway, .2 and .3 map the Azure DNS IPs, .255 broadcast. A /29 gives 3 usable addresses. |
| Add a subnet | At any time, if the range doesn't overlap another subnet and there's space left in the VNet range. |
| Resize or change the range | Only while no resource is deployed in the subnet. |
| Delete | Only when the subnet contains no resources. |
| Delegation change | If a resource of the service is already in the subnet, you can't add or remove delegations until all resources of that service are removed. |
| NSG, route table, NAT gateway | Each must exist in the same subscription and location as the VNet. You can add them after the subnet exists. |
| Service endpoint on an existing subnet | Routes switch on every NIC in the subnet. Open TCP connections might be terminated, so don't do it while critical tasks run. |
A subnet name must be unique in the VNet. Use a letter as the first character: Application Gateway can't deploy into a subnet whose name starts with a number.
Subnets for Azure services
| Service | Subnet requirement |
|---|---|
| VPN or ExpressRoute gateway | Subnet named exactly GatewaySubnet. /27 or larger (as small as /29 for the Basic SKU only). Deploy nothing else in it. NSGs and a 0.0.0.0/0 UDR on it aren't supported. One VPN gateway and one ExpressRoute gateway per VNet. |
| Azure Firewall | AzureFirewallSubnet, size /26; enough for all scaling. Subnet-level NSGs are disabled on it. |
| Azure Firewall management NIC | Separate AzureFirewallManagementSubnet, minimum /26, with its own public IP. Needed for forced tunneling. Basic firewalls and Secured Hub firewalls always have it. |
| Azure Bastion | Dedicated subnet named AzureBastionSubnet, /26 or larger, in the same VNet. This applies to every SKU except Bastion Developer. |
| Application Gateway | Dedicated subnet; no other resource type and no mix of v1 and v2. One private IP per instance, one more for a private frontend, plus the 5 reserved. v2 supports up to 125 instances: /24 recommended. v1 (Standard or WAF) up to 32 instances: /26 recommended. GatewaySubnet is reserved for VPN gateways. |
| App Service VNet integration | Dedicated subnet, delegated. One IP per App Service plan instance, and the count temporarily doubles during scale up or down. Size can't change after assignment. Minimum /28 (portal creates /27 or larger); /26 covers the maximum scale of a plan. |
| Private endpoint | A NIC with a private IP from the subnet. The endpoint must be in the same region and subscription as the VNet. The target resource can be in another region. |
| Azure DNS Private Resolver endpoint | Own subnet, /28 to /24, delegated only to Microsoft.Network/dnsResolvers. One endpoint per subnet. |
Private endpoint or service endpoint
| Private endpoint | Service endpoint | |
|---|---|---|
| What it is | A network interface with a private IP in your subnet. | A setting on a subnet that extends the VNet identity to the service. |
| DNS | Needs DNS that resolves the name to the private IP. | DNS names keep resolving to the service's public IPs. |
| Source IP seen by the service | Traffic goes to the private IP of the endpoint NIC. | Switches from public IPv4 to the VNet private IPv4 address. |
| On-premises | Reachable over VPN or ExpressRoute. | Can't be used for traffic from on-premises. |
| Microsoft guidance | Microsoft recommends Private Link and private endpoints for secure, private access to Azure services. | Same page points readers to private endpoints. |
- Private endpoint network policies (NSG, UDR, ASG support) are disabled by default. The setting is per subnet and affects all private endpoints in it. You can enable NSG only, UDR only, or both.
- To override the
/32route of a private endpoint, enable UDR network policy and use a custom prefix length equal to or larger than the VNet address space prefix length. A0.0.0.0/0route doesn't override it, because it covers a broader range than the private endpoint's address space. - A private endpoint doesn't necessarily close public access to the service. Add the service's own access controls.
Subnet delegation, shared and dedicated subnets
- Delegation designates a subnet for an Azure PaaS service that is injected into your VNet. The VNet owner does it; the service then creates its instances there.
- A delegated subnet lets the service set up basic network rules, such as network intent policies after deployment.
- Each service defines its own model: shared with other services or VMs, or dedicated; whether an NSG or route table may be attached; the minimum number of IPs; whether the address space must be private; whether delegation must be removed before the subnet or VNet can be deleted.
- A delegated subnet can't hold a private endpoint, so don't configure private endpoint network policies on it.
- You can still manage a delegated subnet with NSGs, UDRs and service endpoints, as far as the service allows. Policies and routes the service applies can be overridden by the customer.
- You need
Microsoft.Network/virtualNetworks/subnets/writeto delegate a subnet you didn't create. The built-in Network Contributor role includes it. - A subnet can have zero or several delegations.
| Service | Shared or dedicated |
|---|---|
| Application Gateway, Bastion, VPN gateway | Dedicated subnet. Don't put other resources in it. |
| App Service VNet integration | Dedicated, delegated to Microsoft.Web/serverFarms. |
| DNS Private Resolver | Dedicated; delegated only to Microsoft.Network/dnsResolvers. |
| Private endpoints | Not allowed in a delegated subnet. |
Delegation is not about who can reach the subnet. It gives the service permission to create service-specific resources in the subnet.
Public IP addresses
| Property | Standard (v1 or v2) | Basic |
|---|---|---|
| Status | Current | Retired on September 30, 2025 |
| Allocation | Static only | IPv4 dynamic or static; IPv6 dynamic |
| Security | Closed to inbound traffic by default; an NSG must allow traffic | Open by default |
| Zones | Non-zonal, zonal or zone-redundant (v2: zone-redundant only). Formerly non-zonal IPs are now zone-redundant | Not supported |
| Routing preference Internet | Supported on Standard (not v2) | Not supported |
| Global tier (cross-region load balancer) | Supported on Standard (not v2) | Not supported |
| Idle timeout | Inbound flows 4–30 minutes, default 4; outbound fixed 4 | Same |
- Can't change after creation: the availability zone and the routing preference. SKU: Microsoft's pages differ. The public IP address page's settings table says you can't change the SKU after creation, but the same page lists "Upgrade a basic IP to standard" under Modify for a disassociated IP, and a separate Basic-to-Standard upgrade guidance page describes the upgrade. Don't memorise either side as a rule.
- Dynamic: the address isn't assigned until the IP is associated, and it's released when the resource is stopped (deallocated) or deleted. Static: assigned at creation, released only on delete. You can't choose the address.
- Use static when you must update firewall rules, when a changed IP would mean updating DNS A records, when partners use IP-based security, or when TLS/SSL certificates are linked to an IP.
- A DNS name label gives
<label>.<location>.cloudapp.azure.com. The label must be unique within the Azure location. - Standard v2 public IPs work only with the Standard v2 NAT gateway. A Standard load balancer and its public IPs need matching SKUs; you can't mix Basic and Standard.
- IPv4 public IPs have a nominal charge; IPv6 public IPs are free. IPv6 limits: no VPN gateway in an IPv6-enabled VNet, no IPv6-only VMs (each NIC needs an IPv4 IP configuration), no reverse DNS.
- You can move a Standard public IP across resource groups (while attached, except to a virtual network gateway) and across subscriptions (only when detached). You can't move it across regions.
What a public IP can attach to
| Resource | Static IPv4 | Dynamic IPv4 |
|---|---|---|
| VM network interface, public load balancer | Yes | Yes |
| VPN gateway | Yes | Yes (non-AZ only) |
| NAT gateway, Azure Firewall, Bastion, Route Server, API Management | Yes | No |
| Application Gateway | Yes (v2 only) | Yes (v1 only) |
- A resource without a public IP can still go out to the internet. Azure assigns default outbound access: a Microsoft-owned IP that can change without notice. It stops when you assign a public IP, use a Standard load balancer backend pool, or put a NAT gateway on the subnet.
- For the API released after March 31, 2026, new VNets default to private subnets with no default outbound access. Existing VNets aren't changed.
- A NIC must always keep at least one private IPv4 address. A private IP is dynamic (next free address) or static (you pick an unused address outside the first four). Static addresses are released only when the NIC is deleted.
- A Standard public IP on a VM NIC receives no traffic until an NSG explicitly allows it.
- To delete a public IP it must first be dissociated from every IP configuration. Deleted addresses can't be recovered.
- Default limit: 10 Standard public IPs per region and subscription for most offers; contact support to raise it.
Public IP prefixes and custom IP prefixes (BYOIP)
Public IP prefix
- A public IP prefix is a reserved contiguous range of Standard SKU static public IPs in one region and subscription. You choose the size; Azure chooses the addresses.
- Sizes:
/28= 16,/29= 8,/30= 4,/31= 2 addresses (IPv4); IPv6 uses/124to/127. Microsoft-owned prefixes are limited to 16 addresses. A prefix derived from a custom prefix can be as large as the custom prefix. - The size can't be changed after creation. Every address in the prefix counts against the regional quota from the day the prefix exists.
- Create the prefix first, then create static Standard public IPs from it. Deleted IPs return to the prefix. A prefix can't be deleted while any of its IPs is in use.
- Addresses must be used in the same region and subscription as the prefix, and only by Azure Resource Manager resources.
- In regions with availability zones a prefix can be zone-redundant or tied to a specific zone.
| Use a prefix when… | Detail |
|---|---|
| Partners allow-list your IPs | One firewall rule covers the whole prefix. VMs scaled out later get IPs from the same range. |
| Scale NAT gateway outbound | A NAT gateway can have no more than 16 IPs; a /28 prefix is the largest that can be used. |
| Scale load balancer outbound | The prefix serves outbound connections only, not inbound. |
| VM Scale Sets | Use a prefix to generate instance-level IPs; no separate public IP resources are created. |
| Azure Firewall | You can't attach the prefix itself, but the firewall can use individual Standard public IPs created from it. |
Custom IP prefix (bring your own IP)
- A custom IP prefix is a contiguous range owned by you and registered with a Regional Internet Registry (ARIN, RIPE, APNIC, LACNIC or AFRINIC). Microsoft is permitted to advertise it. You keep ownership.
- Three phases: Validation (ROA with origin AS 8075 for the public cloud, signed message, certificate in the registry record), Provision (resource created, not advertised, not reachable) and Commission (advertised).
- You can't attach a custom prefix to a resource. Derive public IP prefixes and Standard public IPs from it. Public IP prefixes derived from it can't be moved to another subscription, and provisioned ranges can't move either.
- Models: Unified (one range, advertised by Microsoft WAN and the region) and Global/Regional (parent advertised by the WAN, children by regions). You can't migrate between models; deprovision and onboard again.
- Default sizes: unified
/21to/24; global (parent)/21to/24and regional (child)/22to/26; IPv6 parent/48, child/64. Maximum five custom IP prefixes per region by default. - In regions with availability zones the custom IPv4 prefix must be zone-redundant or in one zone.
- Not supported: Internet routing preference or Global tier IPs from the prefix, Standard v2 IPs, advertisement over ExpressRoute Microsoft peering.
- Order to remove: delete the public IP prefixes created from it, decommission to stop the advertisement, then deprovision and delete. Decommission before you change or delete the ROA.
- There's no charge for custom IP prefixes or the IPs derived from them. Traffic to the range is charged at the internet egress rate.
| Step | Time (estimate on the page) |
|---|---|
| Provisioning | About 30 minutes |
| Commissioning (unified or global) | 3-4 hours |
| Commissioning a regional prefix | About 30 minutes |
| Decommissioning | 3-4 hours |
CLI and PowerShell
| Task | Azure CLI | PowerShell |
|---|---|---|
| Create a virtual network | az network vnet create --resource-group myResourceGroup --name myVNet | New-AzVirtualNetwork @net |
| Change the address space | az network vnet update --resource-group myResourceGroup --name myVNet --address-prefixes 10.1.0.0/16 | Set-AzVirtualNetwork |
| Add a subnet | az network vnet subnet create --name <subnetName> --resource-group <resourceGroupName> --vnet-name <virtualNetworkName> | Add-AzVirtualNetworkSubnetConfig |
| Delegate a subnet to a service | az network vnet subnet update --resource-group test-rg --name subnet-1 --vnet-name vnet-1 --delegations Microsoft.Sql/managedInstances | Add-AzDelegation |
| Check a subnet delegation | az network vnet subnet show --resource-group test-rg --name subnet-1 --vnet-name vnet-1 --query delegations | Get-AzDelegation |
| Create a zone-redundant Standard public IP | az network public-ip create --resource-group QuickStartCreateIP-rg --name myStandardPublicIP --version IPv4 --sku Standard --zone 1 2 3 | New-AzPublicIpAddress |
| Public IP with Internet routing preference | az network public-ip create --resource-group QuickStartCreateIP-rg --name myStandardPublicIP-RP --version IPv4 --ip-tags 'RoutingPreference=Internet' --sku Standard --zone 1 2 3 | - |
| Global tier public IP | az network public-ip create --resource-group QuickStartCreateIP-rg --name myStandardPublicIP-Global --version IPv4 --tier global --sku Standard | - |
| Create a public IP prefix | az network public-ip prefix create --length 28 --name myPublicIpPrefix --resource-group QuickStartCreateIPPrefix-rg --sku standard --location westus2 --version IPv4 --zone 1 2 3 | New-AzPublicIpPrefix |
| Create a static public IP from a prefix | az network public-ip create --name myPublicIP --resource-group QuickStartCreateIPPrefix-rg --allocation-method Static --public-ip-prefix myPublicIpPrefix --sku Standard --version IPv4 | - |
| Delete a public IP prefix | az network public-ip prefix delete --name myPublicIpPrefix --resource-group QuickStartCreateIPPrefix-rg | Remove-AzPublicIpPrefix |
| Provision a custom IP prefix (unified, zone-redundant) | az network custom-ip prefix create --name myCustomIpPrefix --resource-group myResourceGroup --location westus2 --cidr '1.2.3.0/24' --zone 1 2 3 --authorization-message $byoipauth --signed-message $byoipauthsigned | - |
| Commission a custom IP prefix | az network custom-ip prefix update --name myCustomIpPrefix --resource-group myResourceGroup --state commission | Update-AzCustomIpPrefix |
| Decommission a custom IP prefix | az network custom-ip prefix update ... --state decommission | Update-AzCustomIpPrefix ... -Decommission |
| Set a static private IP on a NIC | az network nic ip-config update --resource-group myResourceGroup --nic-name myNic --name myIpConfig --private-ip-address 10.0.0.10 | Set-AzNetworkInterfaceIpConfig -Name myIpConfig -NetworkInterface $nic -Subnet $subnet -PrivateIpAddress 10.0.0.10 |
| Add an IP configuration to a NIC | az network nic ip-config create --resource-group myResourceGroup --name myIpConfig --nic-name myNic | - |
Exam Tips
Tick each tip once you can answer it without looking.
“A /24 subnet: how many addresses can you assign to VMs?” → 251. Azure reserves 5 in every subnet: the first four and the last.. Trap: 256 minus 2 ignores the 5 addresses Azure reserves. A /29 gives only 3 usable addresses.
“Smallest IPv4 subnet, and IPv6 subnet size” → /29 for IPv4; IPv6 subnets must be exactly /64.. Trap: A subnet smaller than /29 isn't supported.
“Connect two VNets or a VNet and on-premises, but the ranges overlap” → They can't be connected. Re-address one side before you peer or connect.. Trap: Overlapping ranges block the connection; adding a peering or gateway doesn't change that.
“Add an address range to a VNet that is already peered” → Allowed if the new range doesn't overlap the peer or on-premises ranges. You can add, remove and modify ranges.. Trap: You can't remove a range that still contains a subnet.
“VPN gateway subnet” → Name it exactly GatewaySubnet, /27 or larger (/29 only for Basic). Put nothing else in it.. Trap: No NSG and no 0.0.0.0/0 UDR on it. Application Gateway can't use it.
“Azure Firewall and Azure Bastion subnets” → AzureFirewallSubnet /26; AzureBastionSubnet /26 or larger in the same VNet.. Trap: Bastion hosts deployed in a /27 subnet before November 2, 2021 keep working; newer ones need /26 or larger. Bastion Developer needs no AzureBastionSubnet.
“Firewall needs forced tunneling to on-premises” → Enable the management NIC: it needs AzureFirewallManagementSubnet (min /26) and its own public IP.. Trap: Basic and Secured Hub firewalls already have the management NIC.
“Size the Application Gateway v2 subnet” → /24 recommended: up to 125 instances + 1 private frontend + 5 reserved.. Trap: v1 supports 32 instances (/26 recommended). You can't mix v1 and v2 in one subnet or add other resources.
“App Service regional VNet integration subnet” → A dedicated, delegated subnet, /28 or larger; /26 covers one plan at maximum scale.. Trap: The size can't change after assignment, and scaling temporarily doubles the IPs used.
“Why can't you delete or change a subnet?” → Resources still sit in it, or a delegation is in use. Remove the resources (and the delegation) first.. Trap: Changing the address range also needs an empty subnet.
“Which subnet setting lets an Azure PaaS service create its instances in your VNet?” → Subnet delegation to the service (for example Microsoft.Sql/managedInstances).. Trap: A service endpoint doesn't deploy anything into the subnet; it extends the VNet identity to the service.
“Private endpoint in a delegated subnet; enable NSG policy there” → Not possible. A delegated subnet can't hold a private endpoint.. Trap: Private endpoint network policies are off by default and apply per subnet, to all private endpoints in it.
“Route private endpoint traffic through a firewall NVA” → Enable UDR network policy on the subnet and add a UDR with a prefix length equal to or larger than the VNet address space prefix length.. Trap: A 0.0.0.0/0 UDR covers a broader range than the VNet address space, so it doesn't override the private endpoint route.
“Public IP that must stay the same after the VM is stopped (deallocated)” → Static allocation on a Standard SKU public IP.. Trap: A dynamic address is released on stop and can change. A static address can't be chosen; Azure picks it.
“Standard public IP on a VM NIC, but nobody can connect” → Standard SKU is closed by default. Associate an NSG that allows the traffic.. Trap: Basic SKU public IPs were open by default, and they're retired.
“Change a public IP from Basic to Standard, or change its zone” → The availability zone can't change after creation. For the SKU, Microsoft's pages differ (one says you can't change it, another lists an upgrade of a disassociated Basic IP), so follow the Basic-to-Standard upgrade guidance.. Trap: Mixing Basic and Standard SKUs on one load balancer isn't allowed.
“Partner firewall must allow only one range of your outbound IPs” → Public IP prefix. One rule covers the range, and IPs for NAT gateway or load balancer outbound come from it.. Trap: A prefix can't be resized. A NAT gateway can use at most 16 IPs, so /28 is the largest prefix.
“Keep your own public IP range in Azure” → Custom IP prefix (BYOIP): validate, provision, then commission to advertise.. Trap: A custom prefix can't be attached to a resource; derive public IP prefixes or IPs from it. Provisioned means not yet advertised.
Sources
- Azure Virtual Network concepts and best practices
- Azure Virtual Network FAQ
- What is Azure Virtual Network?
- Create, change, or delete a virtual network
- Add, change, or delete a subnet
- Subnet delegation overview
- Add or remove subnet delegation
- VPN gateway settings (gateway subnet)
- Azure Firewall FAQ
- Azure Firewall management NIC
- Azure Bastion configuration settings
- Application Gateway infrastructure configuration
- App Service virtual network integration
- What is a private endpoint?
- Manage network policies for private endpoints
- Virtual network service endpoints
- Public IP addresses in Azure
- Create, change, or delete a public IP address
- Create a public IP (CLI)
- Upgrade a Basic public IP to Standard SKU
- Default outbound access in Azure
- Network interface IP addresses
- Public IP address prefix
- Create a public IP address prefix (CLI)
- Manage a public IP address prefix
- Custom IP address prefix (BYOIP)
- Create a custom IPv4 address prefix
- Manage a custom IP address prefix
- Azure subscription and service limits
- Azure DNS Private Resolver overview
Checked against Microsoft Learn on November 13, 2026.