VNet Peering
regional · global · both directions · forwarded traffic · gateway transit · address space changes
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
How peering works
- There are two types: virtual network peering (same region) and global virtual network peering (across regions). Traffic stays on the Microsoft backbone. No public internet, gateway or encryption is needed.
- Latency between peered VMs in the same region equals latency inside one vnet. Bandwidth is limited by VM size, not by the peering. Creating a peering causes no downtime.
- Peering is not transitive. VNet1-VNet2 plus VNet2-VNet3 gives no VNet1-VNet3 connectivity. Create a direct peering, or route through an NVA in the hub.
- Peered vnets must have non-overlapping address spaces.
- Peering must be created in both directions, one per vnet. Status is Initiated after the first and Connected on both after the second. It isn't established until both are Connected.
- Peered vnets can be in different subscriptions and different Microsoft Entra tenants. Peering can't cross clouds (for example the public cloud to 21Vianet).
- Default Azure name resolution does not work across peered vnets. Use Azure Private DNS or a custom DNS server.
- NSGs still apply across a peering. Full connectivity is the default, and NSGs can block it. The
VirtualNetworkservice tag includes the peered vnet when access is allowed. - If vnets are connected both by peering and by a gateway, traffic uses the peering.
- A vnet that's part of a peering can't be moved to another resource group or subscription. Delete the peering, move, recreate.
Peering settings (set per direction)
| Setting (portal label) | CLI flag | Portal default | What it does |
|---|---|---|---|
| Allow access to remote virtual network | --allow-vnet-access | On | VMs in this vnet can reach the remote vnet |
| Allow forwarded traffic | --allow-forwarded-traffic | Off | Accepts traffic that didn't originate in the peer. It doesn't create UDRs or NVAs |
| Allow gateway / route server in this vnet to forward traffic to the peer | --allow-gateway-transit | Off | This vnet's gateway can serve the peer. Needs a gateway or route server |
| Use the remote vnet's gateway / route server | --use-remote-gateways | Off | This vnet uses the peer's gateway |
In the CLI reference all four flags show a default of False, while the portal pre-selects Allow access. The CLI example always passes --allow-vnet-access.
Gateway transit rules
- Hub-and-spoke with on-premises: the hub has the VPN or ExpressRoute gateway and allow gateway transit. Each spoke enables use remote gateways.
- Use remote gateways works only if the other side has a gateway and has allow gateway transit turned on. It can be enabled in only one of a vnet's peerings. You can't use a remote gateway if the vnet already has its own gateway. A vnet can have only one gateway.
- Local and global peering both support gateway transit.
- A UDR can't use an ExpressRoute gateway as next hop to route between vnets. A UDR next hop can be an NVA IP in a peered vnet or a VPN gateway.
- Point-to-Site VPN clients must be re-downloaded after peering is configured, to get the new routes.
Configure and operate
- Portal: vnet › Peerings › Add. One wizard creates both directions. Refresh until the status goes Updating › Connected.
- CLI or PowerShell: create the peering twice, once from each vnet. With vnets in different resource groups or subscriptions, pass the full remote vnet resource ID.
- Different tenants: if you lack read access to the remote vnet, select "I know my resource ID". Add a guest user from each tenant in the other.
- Pause traffic without deleting: clear "Allow traffic to remote virtual network" on the peering. Deleting one peering also deletes the remote peering.
- Resize address space: adding to a peered vnet's address space works without downtime. Then sync each peering (portal, PowerShell or
az network vnet peering sync). Run sync after every resize. Not supported if the vnet is peered with a classic vnet. - Permissions: Network Contributor, or a custom role with
virtualNetworkPeerings/write(create A to B), read and delete. To remove the remote peering you need Network Contributor, or read and delete on the remote vnet. - Global peering limits: resources can't reach the front-end IP of a Basic load balancer (internal or public) in a globally peered vnet. Standard load balancers work over both types.
- Troubleshoot: effective routes on a NIC show next hop type "Virtual network peering" for each peered address space. You can also use Network Watcher connection troubleshoot.
- There is a nominal charge for ingress and egress over a peering. Peerings per virtual network: 650.
CLI and PowerShell
| Task | Azure CLI | PowerShell |
|---|---|---|
| Create one direction (run for each direction) | az network vnet peering create -n vnet-1-to-vnet-2 --vnet-name vnet-1 --remote-vnet vnet-2 -g test-rg --allow-vnet-access --allow-forwarded-traffic | Add-AzVirtualNetworkPeering -Name vnet-1-to-vnet-2 -VirtualNetwork $vnet1 -RemoteVirtualNetworkId $vnet2.Id |
| List / show | az network vnet peering list, az network vnet peering show | Get-AzVirtualNetworkPeering |
| Change a setting | az network vnet peering update ... --set allowForwardedTraffic=false | Set $peering.AllowForwardedTraffic, then Set-AzVirtualNetworkPeering |
| Sync after an address space change | az network vnet peering sync -g MyResourceGroup -n MyVnet1ToMyVnet2 --vnet-name MyVnet1 | Sync from the portal or PowerShell |
| Delete | az network vnet peering delete | Remove-AzVirtualNetworkPeering |
Exam Tips
Tick each tip once you can answer it without looking.
“Peering status shows Initiated” → The reverse peering isn't created yet: create it from the remote vnet. Trap: Waiting for propagation, or deleting and recreating.
“Hub peered to spoke A and spoke B; A can't reach B” → Peering isn't transitive: add a direct A-B peering, or route through an NVA in the hub. Trap: Enabling gateway transit. It shares a gateway; it doesn't make peering transitive.
“Create a peering with the Azure CLI” → Run az network vnet peering create once from each vnet. Trap: Expecting one command to create both directions. Only the portal wizard does.
“Two vnets both use 10.0.0.0/16” → They can't be peered: address spaces must not overlap. Trap: Assuming peering works if the subnets differ.
“Spokes need to use the hub's VPN gateway” → Hub peering: allow gateway transit. Spoke peering: use remote gateways. Trap: Setting use remote gateways on the hub side.
“Spoke has its own VPN gateway; you enable use remote gateways” → Not possible: a vnet that has a gateway can't use a remote gateway. Trap: Thinking both gateways can coexist.
“Temporarily stop traffic between peered vnets” → Clear "Allow traffic to remote virtual network" on the peering. Trap: Deleting the vnet or its subnets.
“Move a peered vnet to another subscription” → Delete the peering, move the vnet, recreate the peering. Trap: Using Move directly.
“Client can't reach an internal Basic load balancer frontend in a globally peered vnet” → Basic front ends aren't reachable over global peering: use a Standard load balancer. Trap: Adding an NSG rule.
“VMs in peered vnets can't resolve each other's names” → Default Azure DNS doesn't resolve across vnets: use Azure Private DNS or a custom DNS server. Trap: Enabling "Allow forwarded traffic".
“Add address space to a peered vnet” → Allowed without downtime; then sync the peering. Trap: Deleting and recreating the peering.
“Confirm peering at the NIC level” → Effective routes show next hop type Virtual network peering. Trap: Looking at effective security rules.
“Delete the peering from vnet A” → The peering on vnet B is removed too. Trap: Expecting B's peering to be left behind.
“Role needed to create a peering” → Network Contributor (virtualNetworkPeerings/write). Trap: Granting Reader only. The role needs the peering write action.
“Peer vnets in different Microsoft Entra tenants” → Supported: add a guest user from each tenant in the other when using resource IDs. Trap: Believing peering doesn't work across tenants.
“Peer a public-cloud vnet with a 21Vianet vnet” → Not supported: peering can't cross clouds. Trap: Using global peering.
“CLI peering created with no flags; VMs still can't talk” → Add --allow-vnet-access on both peerings (the CLI reference default is False). Trap: Assuming the CLI default matches the portal's, which is on.
“Address space of a peered vnet was changed” → Run az network vnet peering sync (or sync in the portal or PowerShell). Trap: Deleting and recreating the peering.
Sources
- Azure virtual network peering
- Create, change, or delete virtual network peering
- Azure Virtual Network FAQ
- az network vnet peering
- Azure subscription and service limits
Checked against Microsoft Learn on November 13, 2026.