You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can configure a custom DNS server and enable DNS proxy for Azure Firewall policies. You can configure these settings when you deploy the firewall or later from the **Settings**, **DNS** page.
14
+
You can configure a custom DNS server and enable DNS proxy for Azure Firewall. Configure these settings when you deploy the firewall, or configure them later from the **DNS settings** page. By default, Azure Firewall uses Azure DNS and DNS Proxy is disabled.
15
15
16
16
## DNS servers
17
17
18
-
A DNS server maintains and resolves domain names to IP addresses. By default, Azure Firewall uses Azure DNS for name resolution. The **DNS servers** setting lets you configure your own DNS servers for Azure Firewall name resolution. You can configure a single or multiple servers.
18
+
A DNS server maintains and resolves domain names to IP addresses. By default, Azure Firewall uses Azure DNS for name resolution. The **DNS server** setting lets you configure your own DNS servers for Azure Firewall name resolution. You can configure a single server or multiple servers. If you configure multiple DNS servers, the server used is chosen randomly. You can configure a maximum of 15 DNS servers in **Custom DNS**.
19
+
20
+
> [!NOTE]
21
+
> For instances of Azure Firewall that are managed by using Azure Firewall Manager, the DNS settings are configured in the associated Azure Firewall policy.
22
+
23
+
### Configure custom DNS servers - Azure portal
24
+
25
+
1. Under Azure Firewall **Settings**, select **DNS Settings**.
26
+
2. Under **DNS servers**, you can type or add existing DNS servers that were previously specified in your virtual network.
27
+
3. Select **Apply**.
28
+
29
+
The firewall now directs DNS traffic to the specified DNS servers for name resolution.
30
+
31
+
:::image type="content" source="../firewall/media/dns-settings/dns-servers.png" alt-text="Screenshot showing settings for D N S servers.":::
32
+
33
+
### Configure custom DNS servers - Azure CLI
34
+
35
+
The following example updates Azure Firewall with custom DNS servers by using the Azure CLI.
36
+
37
+
```azurecli-interactive
38
+
az network firewall update \
39
+
--name fwName \
40
+
--resource-group fwRG \
41
+
--dns-servers 10.1.0.4 10.1.0.5
42
+
```
43
+
44
+
> [!IMPORTANT]
45
+
> The command `az network firewall` requires the Azure CLI extension `azure-firewall` to be installed. You can install it by using the command `az extension add --name azure-firewall`.
46
+
47
+
### Configure custom DNS servers - Azure PowerShell
48
+
49
+
The following example updates Azure Firewall with custom DNS servers by using Azure PowerShell.
You can configure Azure Firewall to act as a DNS proxy. A DNS proxy acts as an intermediary for DNS requests from client virtual machines to a DNS server. If you configure a custom DNS server, you should enable DNS proxy to avoid DNS resolution mismatch, and enable FQDN filtering in network rules.
61
+
You can configure Azure Firewall to act as a DNS proxy. A DNS proxy is an intermediary for DNS requests from client virtual machines to a DNS server.
62
+
63
+
If you want to enable FQDN (fully qualified domain name) filtering in network rules, enable DNS proxy and update the virtual machine configuration to use the firewall as a DNS proxy.
64
+
65
+
:::image type="content" source="../firewall/media/dns-settings/dns-proxy-2.png" alt-text="D N S proxy configuration using a custom D N S server.":::
66
+
67
+
If you enable FQDN filtering in network rules, and you don't configure client virtual machines to use the firewall as a DNS proxy, then DNS requests from these clients might travel to a DNS server at a different time or return a different response compared to that of the firewall. It’s recommended to configure client virtual machines to use the Azure Firewall as their DNS proxy. This puts Azure Firewall in the path of the client requests to avoid inconsistency.
68
+
69
+
When Azure Firewall is a DNS proxy, two caching function types are possible:
23
70
24
-
If you don't enable DNS proxy, DNS requests from the client may travel to a DNS server at a different time or return a different response compared to that of the firewall. DNS proxy puts Azure Firewall in the path of the client requests to avoid inconsistency.
71
+
-**Positive cache**: DNS resolution is successful. The firewall caches these responses according to the TTL (time to live) in the response up to a maximum of 1 hour.
25
72
26
-
DNS Proxy configuration requires three steps:
73
+
-**Negative cache**: DNS resolution results in no response or no resolution. The firewall caches these responses according to the TTL in the response, up to a max of 30 minutes.
27
74
28
-
1. Enable DNS proxy in Azure Firewall DNS settings.
29
-
2. Optionally configure your custom DNS server or use the provided default.
30
-
3. Finally, you must configure the Azure Firewall’s private IP address as a Custom DNS address in your virtual network DNS server settings. This ensures DNS traffic is directed to Azure Firewall.
75
+
The DNS proxy stores all resolved IP addresses from FQDNs in network rules. As a best practice, use FQDNs that resolve to one IP address.
31
76
32
-
##Configure firewall policy DNS
77
+
### Policy inheritance
33
78
34
-
1. Select your firewall policy.
35
-
2. Under **Settings**, select **DNS**.
36
-
1. Select **Enabled** to enable DNS settings for this policy.
37
-
1. Under **DNS servers**, you can accept the **Default (Azure provided)** setting, or select **Custom** to add custom DNS servers you'll configure for your virtual network.
38
-
1. Under **DNS Proxy**, select **Enabled** to enable DNS Proxy if you configured a customer DNS server.
39
-
1. Select **Apply**.
79
+
Policy DNS settings applied to a standalone firewall override the standalone firewall’s DNS settings. A child policy inherits all parent policy DNS settings, but it can override the parent policy.
40
80
81
+
For example, to use FQDNs in network rule, DNS proxy should be enabled. But if a parent policy does **not** have DNS proxy enabled, the child policy won't support FQDNs in network rules unless you locally override this setting.
41
82
42
-
##Configure virtual network
83
+
### DNS proxy configuration
43
84
44
-
To configure DNS proxy, you must also configure your virtual network DNS servers setting to use the firewall private IP address.
85
+
DNS proxy configuration requires three steps:
86
+
1. Enable the DNS proxy in Azure Firewall DNS settings.
87
+
2. Optionally, configure your custom DNS server or use the provided default.
88
+
3. Configure the Azure Firewall private IP address as a custom DNS address in your virtual network DNS server settings. This setting ensures DNS traffic is directed to Azure Firewall.
45
89
46
-
### Configure virtual network DNS servers
90
+
####Configure DNS proxy - Azure portal
47
91
48
-
1. Select the virtual network where the DNS traffic will be routed through the Azure Firewall.
92
+
To configure DNS proxy, you must configure your virtual network DNS servers setting to use the firewall private IP address. Then enable the DNS proxy in the Azure Firewall **DNS settings**.
93
+
94
+
##### Configure virtual network DNS servers
95
+
96
+
1. Select the virtual network where the DNS traffic is routed through the Azure Firewall instance.
49
97
2. Under **Settings**, select **DNS servers**.
50
-
3. Select **Custom** under **DNS servers**.
51
-
4. Enter the firewall’s private IP address.
98
+
3. Under **DNS servers**, select **Custom**.
99
+
4. Enter the firewall's private IP address.
100
+
5. Select **Save**.
101
+
6. Restart the VMs that are connected to the virtual network so they're assigned the new DNS server settings. VMs continue to use their current DNS settings until they're restarted.
102
+
103
+
##### Enable DNS proxy
104
+
105
+
1. Select your Azure Firewall instance.
106
+
2. Under **Settings**, select **DNS settings**.
107
+
3. By default, **DNS Proxy** is disabled. When this setting is enabled, the firewall listens on port 53 and forwards DNS requests to the configured DNS servers.
108
+
4. Review the **DNS servers** configuration to make sure that the settings are appropriate for your environment.
52
109
5. Select **Save**.
53
110
111
+
:::image type="content" source="../firewall/media/dns-settings/dns-proxy.png" alt-text="Screenshot showing settings for the D N S proxy.":::
112
+
113
+
#### Configure DNS proxy - Azure CLI
114
+
115
+
You can use the Azure CLI to configure DNS proxy settings in Azure Firewall. You can also use it to update virtual networks to use Azure Firewall as the DNS server.
116
+
117
+
##### Configure virtual network DNS servers
118
+
119
+
The following example configures the virtual network to use Azure Firewall as the DNS server.
120
+
121
+
```azurecli-interactive
122
+
az network vnet update \
123
+
--name VNetName \
124
+
--resource-group VNetRG \
125
+
--dns-servers <firewall-private-IP>
126
+
```
127
+
128
+
##### Enable DNS proxy
129
+
130
+
The following example enables the DNS proxy feature in Azure Firewall.
131
+
132
+
```azurecli-interactive
133
+
az network firewall update \
134
+
--name fwName \
135
+
--resource-group fwRG \
136
+
--enable-dns-proxy true
137
+
```
138
+
139
+
#### Configure DNS proxy - Azure PowerShell
140
+
141
+
You can use Azure PowerShell to configure DNS proxy settings in Azure Firewall. You can also use it to update virtual networks to use Azure Firewall as the DNS server.
142
+
143
+
##### Configure virtual network DNS servers
144
+
145
+
The following example configures the virtual network to use Azure Firewall as a DNS server.
DNS proxy has a failover mechanism that stops using a detected unhealthy server and uses another DNS server that is available.
168
+
169
+
If all DNS servers are unavailable, there's no fallback to another DNS server.
170
+
171
+
### Health checks
172
+
173
+
DNS proxy performs five-second health check loops for as long as the upstream servers report as unhealthy. The health checks are a recursive DNS query to the root name server. Once an upstream server is considered healthy, the firewall stops health checks until the next error. When a healthy proxy returns an error, the firewall selects another DNS server in the list.
54
174
55
175
## Next steps
56
176
57
-
[FQDN filtering in network rules](fqdn-filtering-network-rules.md)
177
+
-[Azure Firewall DNS Proxy details](../firewall/dns-details.md)
178
+
-[FQDN filtering in network rules](fqdn-filtering-network-rules.md)
0 commit comments