Azure Firewall Policy

Azure Firewall Policy is a modern way to manage firewall rules and settings centrally. It allows you to define, manage, and deploy firewall configurations across your Azure network securely and efficiently.

Policy Structure

An Azure Firewall Policy is composed of several key components that define its behavior:

Rule Collections

Rule collections provide a structured way to organize your firewall rules. They are evaluated in a specific order: Network Rule Collections first, followed by Application Rule Collections.

Network Rules

Network rules allow you to control network traffic based on Layer 3 and Layer 4 information. You can specify:

Example Network Rule Collection:


{
  "name": "AllowWebTraffic",
  "priority": 100,
  "action": {
    "type": "Allow"
  },
  "rules": [
    {
      "name": "AllowHTTPS",
      "protocols": ["TCP"],
      "sourceAddresses": ["10.0.0.0/16"],
      "destinationAddresses": ["*"],
      "destinationPorts": ["443"]
    }
  ]
}
            

Application Rules

Application rules provide more granular control over HTTP/S traffic by allowing filtering based on FQDNs (Fully Qualified Domain Names) and FQDN tags.

Example Application Rule Collection:


{
  "name": "AllowAzureServices",
  "priority": 200,
  "action": {
    "type": "Allow"
  },
  "rules": [
    {
      "name": "AllowWindowsUpdate",
      "protocols": [{"protocolType": "Http", "port": 80}, {"protocolType": "Https", "port": 443}],
      "sourceAddresses": ["10.1.1.0/24"],
      "targetFqdns": ["*.windowsupdate.com"]
    },
    {
      "name": "AllowOffice365",
      "protocols": [{"protocolType": "Http", "port": 80}, {"protocolType": "Https", "port": 443}],
      "sourceAddresses": ["10.1.1.0/24"],
      "fqdnTags": ["Office365"]
    }
  ]
}
            

DNS Settings

You can configure your Azure Firewall to use custom DNS servers, which is essential for resolving internal and external hostnames correctly. This can be set directly on the firewall policy.

Ensure your custom DNS servers are reachable by the Azure Firewall.

IDPS Settings

Azure Firewall's Intrusion Detection and Prevention System (IDPS) provides advanced threat protection by inspecting traffic for malicious activity based on a curated threat intelligence feed. You can enable IDPS, configure threat intelligence feeds, and define custom rules.

Key IDPS features include:

Management

Azure Firewall Policies can be managed through the Azure portal, Azure CLI, Azure PowerShell, or ARM templates. Centralized management simplifies policy updates and ensures consistency across your deployments.

Consider using Azure Firewall Manager for managing firewall policies in complex, large-scale environments, especially those using hub-spoke architectures.

Best Practices

Azure Firewall Policy REST API

Create or Update Policy

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}?api-version=2021-02-01

This operation creates or updates an Azure Firewall Policy.

Get Policy

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}?api-version=2021-02-01

This operation retrieves an Azure Firewall Policy.