We are running an Azure Function App with VNet integration. The VNet that we're integrating with has custom DNS servers configured. When our application runs or I run nslookup from SCM/Kudu I'm not able to resolve the address of a zone configured in our DNS servers.
If I specify the custom DNS server in the nslookup command, then the resolution works correctly. If I don't specify the DNS server in the nslookup command, then it uses the default 168.63.129.16, and the address does not resolve
Why isn't the Function App using the custom DNS servers?
When you are integrating an Azure function app by default virtual network uses DNS server only.You can use custom DNS server like below:
I created function app with vnet integeration like below
You can make use of configuring DNS setting for vnet integeration:
In your virtual network -> under setting, DNS server -> select Custom and enter the IP addresses of your custom DNS servers and Save.
The Function App should use the specific DNS servers that have been set up in the VNet once you configured the DNS settings in the networking setup of the Function App
You can make use of following commands in the Kudu DebugConsole
https://.scm.azurewebsites.net/DebugConsoleto see if the hostname is returning the right IP address. Use nameresolver domain IPofDNSServer and Nameresolver.exe, an alternative to nslookup, if it fails.Ensure you have your DNS cache is cleared by using this
ipconfig /flushdnsyour debug consoleAdditionally, you can create a DNS zone and add a record set to authorise your server:
References:
Azure Functions networking options | Microsoft Learn
Integrate Azure DNS with your Azure resources - Azure DNS | Microsoft Learn