I have an Azure Virtual Network Gateway with P2S VPN setup using OpenVPN and Azure AD authentication. Works great as far as connectivity and routing. But it doesn't set the DNS servers from the vnet. It says it does in the Azure VPN client but when you try to resolve something it is still using the local network's DNS (192.168.1.1).
1 Answers
To confirm your in-use DNS settings when using Azure AD authentication for your P2S VPN gateway, you could consult Get-DnsClientNrptPolicy
in PowerShell. Get reference here.
From the FAQ, the Azure DNS servers take precedence over the local DNS servers that are configured in the client (unless the metric of the Ethernet interface is lower). You can use Get-NetIPInterface in PowerShell to check the metric. For me, the metric of the Ethernet interface is lower with having higher priority.
The Nslookup
tool uses the local default system DNS server when you have not set the specific DNS server. You can append the custom DNS server value if you want to query it.
For example, I have a DNS server in the Azure VNet and have set the DNS server IP address 10.0.0.4
in the custom DNS server in that VNet. To get name resolution by the Azure DNS server, append the DNS server IP when nslookup
.