Azure Virtual Networking
Building the Snips network·60 minutes
Building the Snips network
The governance framework is in place. Now it is time to build the network that will host the Contractor Document Portal. Before you can deploy a single virtual machine, you need a virtual network with the right subnets, security rules and routing.
Networking is one of the most important skills for an Azure Administrator. Get it wrong and resources cannot communicate, applications are exposed to the internet, or legitimate traffic is blocked. This module builds the Snips network from scratch.
What you will learn
IP addressing and CIDR
Azure virtual networks use private IP address ranges. The three private ranges are:
10.0.0.0/8Largest range. Snips uses 10.20.0.0/16 from this space.172.16.0.0/12Medium range. Often used for smaller environments.192.168.0.0/16Smallest range. Common in home and small office networks.CIDR notation (e.g. 10.20.0.0/16) defines the network address and the number of bits used for the network portion. The remaining bits are available for host addresses. A /16 gives 65,536 addresses; a /24 gives 256.
CIDR calculator
The Snips virtual network
The Snips production VNet is vnet-snips-prod-uks-001 with address space 10.20.0.0/16. It contains four subnets:
| Subnet | Address range | Purpose |
|---|---|---|
| snet-web-prod-uks-001 | 10.20.1.0/24 | Web tier — internet-facing resources |
| snet-app-prod-uks-001 | 10.20.2.0/24 | Application tier — internal services |
| snet-mgmt-prod-uks-001 | 10.20.3.0/24 | Management — admin access only |
| snet-pe-prod-uks-001 | 10.20.4.0/24 | Private endpoints for PaaS services |
Network Security Groups
Network Security Group (NSG)
A set of inbound and outbound security rules that filter network traffic. Can be applied to a subnet or a network interface. Rules are evaluated in priority order (lowest number first).
NSG rule
Defines: priority, name, direction (inbound/outbound), source, destination, port, protocol and action (Allow/Deny). The first matching rule wins.
Default rules
Every NSG has default rules that cannot be deleted: allow VNet inbound, allow Azure Load Balancer inbound, deny all other inbound. Allow VNet outbound, allow internet outbound, deny all other outbound.
NSG rule simulator
The Web subnet NSG has these rules. For each scenario, which rule applies and what is the result?
| Priority | Name | Source | Port | Action |
|---|---|---|---|---|
| 100 | Allow-HTTPS | Internet | 443 | Allow |
| 200 | Allow-HTTP | Internet | 80 | Allow |
| 300 | Allow-RDP-Mgmt | Mgmt subnet | 3389 | Allow |
| 4096 | DenyAllInbound | Any | Any | Deny |
1. HTTPS request from the internet to the Web subnet
2. RDP connection from the internet to any VM
3. RDP connection from the Management subnet to a VM
Networking troubleshooting
VM cannot reach another VM in the same VNet
Check NSG rules on both VMs and their subnets. Use Network Watcher effective security rules.
Application cannot reach port 443 from the internet
Check the NSG on the subnet and the NIC. Verify a public IP is attached. Check the application is listening on 443.
DNS does not resolve internal names
Check the VNet DNS settings. Verify a Private DNS zone is linked to the VNet. Check the DNS zone has the correct records.
Traffic is being denied but no rule should block it
Check the default deny rules. Check for NSGs on both the subnet and the NIC — both are evaluated. Use Network Watcher IP flow verify.
Azure CLI
# Create the Snips VNet
az network vnet create \
--name vnet-snips-prod-uks-001 \
--resource-group rg-network-prod-uks-001 \
--location uksouth \
--address-prefix 10.20.0.0/16
# Create the subnets
az network vnet subnet create \
--vnet-name vnet-snips-prod-uks-001 \
--resource-group rg-network-prod-uks-001 \
--name snet-web-prod-uks-001 \
--address-prefix 10.20.1.0/24
az network vnet subnet create \
--vnet-name vnet-snips-prod-uks-001 \
--resource-group rg-network-prod-uks-001 \
--name snet-app-prod-uks-001 \
--address-prefix 10.20.2.0/24
# Create an NSG
az network nsg create \
--name nsg-web-prod-uks-001 \
--resource-group rg-network-prod-uks-001
# Add an NSG rule to allow HTTPS inbound
az network nsg rule create \
--nsg-name nsg-web-prod-uks-001 \
--resource-group rg-network-prod-uks-001 \
--name Allow-HTTPS-Inbound \
--priority 100 \
--direction Inbound \
--source-address-prefixes Internet \
--destination-port-ranges 443 \
--protocol Tcp \
--access AllowKnowledge check
Five questions on Azure virtual networking.
1.The Snips VNet uses the address space 10.20.0.0/16. How many IP addresses does this provide?
2.A VM in the Web subnet (10.20.1.0/24) cannot reach a VM in the Application subnet (10.20.2.0/24). Both are in the same VNet. What is the most likely cause?
3.You need to allow HTTPS traffic (port 443) from the internet to the Web subnet but block all other inbound traffic. What NSG rule priority should the Allow HTTPS rule have relative to the Deny All rule?
4.The Contractor Document Portal VM needs to resolve internal DNS names for other Snips resources. Which Azure feature provides this?
5.You need to connect the Snips VNet to a second VNet in a different region. Which feature should you use?
Ready to mark this module complete?
Mark complete when you have read all sections, attempted the lab and completed the knowledge check.
- Configure and manage virtual networking