Managing Azure Firewall Policies and Rules
This lesson explains how rule collections are structured, how rules are processed, and how policies are inherited.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the policy hierarchy.
- Distinguish DNAT, network and application rules.
- Explain the fixed processing order.
- Explain parent and child policy precedence.
The firewall policy
A firewall policy is an Azure resource that holds rules and settings. It can be attached to one firewall or many, in several regions, and it replaces the older classic rules. A policy has a hierarchy: rule collection groups contain rule collections, which contain rules. Each group and each collection has a priority, from 100, which is highest, to 65,000, which is lowest. All rules in a collection share one action, allow or deny, and one rule type.
Azure Firewall Manager gives a central view for managing policies across firewalls.
Rule types
There are three rule types, each with a different purpose.
| Rule type | Filters on | Example |
|---|---|---|
| DNAT | Inbound traffic to a firewall public address, which is translated to a private address | Publishing a service: 203.0.113.5:443 to 10.0.1.4:443 |
| Network | Source, destination, port and protocol, or FQDN in Standard and Premium | Allow UDP 123 to a time server |
| Application | FQDN, FQDN tags and web categories, over HTTP, HTTPS or MSSQL | Allow outbound HTTPS to *.contoso.com |
DNAT, network or application rule?
Processing order
Understanding the processing order is one of the most valuable things in this topic. Microsoft's documentation states that application rules are always processed after network rules, and network rules after DNAT rules, regardless of rule collection group priority, rule collection priority or inheritance.
-
Threat intelligence
Known malicious addresses and domains are handled first, if the mode is set to deny.
-
DNAT rules
Inbound traffic is translated.
-
Network rules
If a rule matches, processing ends, and application rules are not reached.
-
Application rules
These are evaluated if no network rule matched.
-
Infrastructure rule collection
A built-in collection allows Azure platform FQDNs.
-
Deny
Traffic that matches nothing is denied.
Within a type, rules are evaluated by rule collection group priority and then by rule collection priority, and the first match ends the process. Rules are terminating. Since network rules come first, a broad network rule that allows all TCP 443 traffic means that an application rule that denies a certain site never takes effect. This is a very common design error.
The following diagram shows the fixed order of rule types.

Priority does not change type order
An option that changes a priority number so that an application rule runs before a network rule is wrong. Priorities order rules within a type, and they never change the order between types.
Rule type order
Policy inheritance
A policy can be built on a parent policy, which suits a central team that sets organization-wide rules, while each application team has a child policy for its own firewall. Microsoft states that the parent policy always takes precedence over the child policy. The child inherits the parent's rules, and processes them first within each rule type, whatever the priorities in the child. The child can only add rules and cannot weaken the parent's.
DNAT and application rules
Inbound connections have a further point. Azure Firewall does not apply application rules to inbound connections. To let inbound HTTP traffic be inspected at layer 7, place an Application Gateway with a WAF in front. A DNAT rule translates the destination, and the translated traffic then needs an allowing route for its return traffic, or it will cause asymmetric routing: if a subnet's default route points to the firewall and the return path bypasses it, then the firewall drops the session as unknown.
IP groups hold reusable lists of addresses for rules. FQDN tags represent well-known Microsoft services, such as Windows Update, so that a person does not need to list them. Web categories allow or deny groups such as social networking, in Standard and Premium.
Inbound and return traffic
A rule that never fires
A policy has a network rule collection, at priority 300, that allows all outbound TCP 443 traffic. An application rule collection, at priority 100, denies *.badsite.example. Users can still reach that site. Why, and what should you change?
Network rules always run before application rules, whatever their priorities. The network rule matches outbound TCP 443 and ends processing, so the application rule never runs. The priority of 100 cannot change this, because it orders collections only within the same type.
Remove the broad network rule and allow HTTPS through application rules instead, with the deny collection at a higher priority than the allow collection. Alternatively, use a network rule with FQDN filtering for specific needs. Lowering the network rule's priority to 65,000 would not help.
Can a child policy override a deny in its parent?
Show answer
No. The parent policy always takes precedence over the child.
Exam Tips
Remember for the exam
- DNAT runs first, then network, then application, whatever the priorities.
- The first matching rule ends processing.
- A parent policy always takes precedence over a child policy.
- Application rules do not apply to inbound DNAT traffic.