Advanced · Azure Firewall · 26 of 32

Allow traffic through Azure Firewall

Your tasks
  • Get vm-spoke1 reaching vm-spoke2 on 443 through azfw-hub

Azure Firewall azfw-hub, at 10.0.1.4 in the hub, is in place, and both spokes route to it. It has no rules yet. Allow HTTPS from spoke1 (10.1.0.0/16) to spoke2 (10.2.0.0/16), and nothing else.

You'll learn
Azure Firewall rules
  1. See the rules. There are none.

    az network firewall network-rule collection list -g rg-lab --firewall-name azfw-hub -o table
    What's this?

    Works with Azure Firewall network rules: allow or deny by source IP, destination IP, port and protocol. Collections are checked by priority, lowest number first, and the first match decides.

    • -g the resource group the resources live in
  2. Add an allow collection with one HTTPS rule.

    az network firewall network-rule create -g rg-lab --firewall-name azfw-hub --collection-name Allow-Spoke1-HTTPS --name https --priority 200 --action Allow --protocols TCP --source-addresses 10.1.0.0/16 --destination-addresses 10.2.0.0/16 --destination-ports 443
    What's this?

    Works with Azure Firewall network rules: allow or deny by source IP, destination IP, port and protocol. Collections are checked by priority, lowest number first, and the first match decides.

    • -g the resource group the resources live in
    • --name the name of the thing to look at or change
    • --priority where the rule sits in the order. Lower numbers are checked first
    • --priority 200 --action Allow only when the collection is new
    • --protocols TCP TCP, UDP, ICMP or Any
  3. Connect to vm-spoke1.

    ssh vm-spoke1
    What's this?

    Opens a shell on vm-spoke1, so the next commands run on that VM. In this lab it's a shortcut. In real Azure you'd connect through something like Azure Bastion, or SSH to an address you can reach.

  4. Test HTTPS to vm-spoke2. Type exit when done.

    nc -zv 10.2.1.4 443
    What's this?

    netcat, a standard Linux tool. Tries to open a TCP connection and reports whether it worked.

    • -z only check whether the port answers. Send no data
    • -v print the result in words
    • 10.2.1.4 where to connect
    • 443 the port to try
  5. Answer the question below.

    Rule collection
    A group of Azure Firewall rules that share one priority and one action.
    Priority
    A number on each rule that sets the order Azure checks the rules in.
Sources on Microsoft Learn (2)
0/1 changes
Network map
?
  • Resource group, the outer dashed frame
  • Virtual network, with its address space top right
  • Subnet, with range and usable IPs (5 reserved)
  • Network security group. A small shield on a VM's NIC means the NIC has one too
  • Route table on the subnet
  • NICVM Appliance Private endpoint
  • Peering Connected Initiated or access off
  • Goal working Goal broken, X marks where it stops
  • Private DNS zone, dotted lines go to linked VNets
  • Orange pulse: what your last command changed. Drag to pan, Ctrl and scroll to zoom.
Resource grouprg-labvnet-spoke1: tap to inspectVirtual networkvnet-spoke110.1.0.0/16subnet-app: tap to inspectsubnet-app10.1.1.0/24 · 251 usablert-spoke1vm-spoke1 10.1.1.4: tap to inspectNICvm-spoke110.1.1.4vnet-hub: tap to inspectVirtual networkvnet-hub10.0.0.0/16AzureFirewallSubnet: tap to inspectAzureFirewallSubnet10.0.1.0/26 · 59 usableazfw-hub 10.0.1.4: tap to inspectFWazfw-hub10.0.1.4vnet-spoke2: tap to inspectVirtual networkvnet-spoke210.2.0.0/16subnet-app: tap to inspectsubnet-app10.2.1.0/24 · 251 usablert-spoke2vm-spoke2 10.2.1.4: tap to inspectNICvm-spoke210.2.1.4Connected: tap to inspectpeeredConnected: tap to inspectpeered:443 ✗
  • vm-spoke1 → vm-spoke2:443should work: not working
  • vm-spoke1 → vm-spoke2:22should stay blocked: blocked
Goals 0/3
Cloud Shell · bashVMsrg-lab · eastus2
cloudshell:~$