Azure Firewall: Private IP Addresses

Azure Firewall relies on both public and private IP addresses to function within your virtual network and to communicate with your on-premises networks.

Understanding Private IP Addresses for Azure Firewall

When you deploy an Azure Firewall instance, it requires a dedicated subnet named AzureFirewallSubnet. This subnet must have a minimum prefix size of /26. The Azure Firewall resource is deployed into this subnet and is assigned a private IP address from within this subnet.

Key Characteristics:

Configuring Private IP Addresses

The private IP address for Azure Firewall is automatically provisioned when you deploy the firewall resource in its dedicated subnet. There is no direct configuration required for the firewall's *private* IP address itself beyond ensuring the AzureFirewallSubnet is correctly sized and named.

Tip: The Azure Firewall service automatically manages the private IP address assigned to the firewall resource. You can view this IP address in the Azure portal under the firewall's overview page.

Default Route Configuration

To ensure traffic is routed through the firewall, you typically configure a default route (0.0.0.0/0) in your virtual network's route table. This route should point to the Azure Firewall's private IP address as the next hop. This forces all traffic from your subnets to pass through the firewall for inspection and policy enforcement.


Resource "azurerm_route_table" "example" {
  name                = "example-routetable"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  route {
    name           = "default"
    address_prefix = "0.0.0.0/0"
    next_hop_type  = "VirtualAppliance"
    next_hop_ip_address = azurerm_firewall.example.ip_configuration[0].private_ip_address # This refers to the firewall's private IP
  }
}

# Associate route table with subnets
resource "azurerm_subnet_route_table_association" "example" {
  subnet_id      = azurerm_subnet.example.id
  route_table_id = azurerm_route_table.example.id
}
            

Scenarios

Note: While the firewall has a private IP for internal operations, it also requires at least one public IP address for NATing outbound traffic and for management. Ensure you allocate sufficient public IPs when deploying the firewall.

For more detailed configuration and best practices, refer to the Azure Firewall Architecture and Azure Firewall Rules documentation.