DNS Hostname Resolution from App Service Plan using VNet Integration

2023-02-22T16:02:47.9966667+00:00

I have question regarding how to setup DNS hostname resolution using VNet Integration.

I have an App Service Plan web site. I have VNet Integration enabled into my VNet. My VNet has its own DNS Server and it is configured to use it. I tried to use a Private DNS Zone as well. Neither of these solutions are providing the means for my web app to connect to my API hosted on a VM in my VNet. The browser can't resolve the hostname of the API. The error message is ERR_NAME_NOT_RESOLVED.

Apart from enabling VNet Integration and having a dedicated a DNS Server. What other configuration is necessary to have DNS working through VNet Integration?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,493 questions
{count} votes

2 answers

Sort by: Most helpful
  1. ajkuma 28,116 Reputation points Microsoft Employee
    2023-02-28T17:59:13.5033333+00:00

    @App Service Plan - DNS Host Name Resolution Issue ,

    Thanks for the follow-up and update. As I understand you have mentioned DNS is working fine and got successful responses on the API port.

    Just to clarify, you mention “the app service plan will not resolve the hostname for the API VM”. Then “the browser cannot resolve the domain name into the IP address”. Are both the browser and API not resolving IPs for the respective domain name?

    You may try these to validate/dig into this more:  

     

    DNS – What is the hostname or custom domain you are trying to access? If you are simply using an IP you can skip this step. First validate is the correct hostname resolving to the expected IP.

    • Under Kudu Console -> Debugging Console -> CMD use the command nameresolver to validate that the hostname is returning the correct IP against the expected DNS server. If it’s not try using nameresolver domain IPofDNSServer as described earlier in case for some reason the app is not targeting the expected DNS server.

     

    •  Lastly if it’s still failing, make sure any other domain that should be working is resolving. If this is failing: – Confirm what DNS server the app is using, if you aren’t sure use the nameresolver domain IPofDNSServer
      – Try step #2 below and tcpping IPofDNSServer:53 to validate the app has connectivity to the DNS server.
      – If that is failing try targeting another well known DNS server to see if something like www.microsoft.com is resolving.
      – If this is failing check the network path and the DNS servers. If you have a secondary try that DNS server as well.

     

    2.Nameresolver.exe : This command is similar to nslookup where it will do a DNS lookup against the DNS server that is configured for the web app. By default, a standard app service will use Azure DNS. If the App Service is configured with VNET integration ( includes both ASE types ), it will use your custom DNS servers configured for the VNET.

    To specify a different DNS server to complete the lookup on, add the IP address of the server after the hostname separated by a space, ie “hostname <DNS Server IP>”.

     

    Please check out the detailed suggestions outlined by one of my colleague, in his personal blog: https://blog.brooksjc.com/2021/09/17/app-service-network-debugging/

     

    0 comments No comments

  2. ajkuma 28,116 Reputation points Microsoft Employee
    2023-02-28T17:59:31.6633333+00:00

     

    Thanks for posting a good question.

    Based on the issue description, I understand you’re wanting to perform name resolution from your web app built by using App Service, linked to a virtual network, to VMs in the same virtual network. If you haven’t done,  the custom DNS server that you have setup, please ensure that you have  a DNS forwarder that forwards queries to Azure (virtual IP 168.63.129.16).

    Also, you need to enable virtual network integration for your web app and select Sync Network under Networking, Virtual Network Integration in the Azure portal for the App Service plan hosting the web app.

    To isolate the issue, you may perform the connectivity test:
    1.Test access via tcpping | for validate connection configuration
    2.Network Troubleshooter from the Diagnose & Solve Problems blade

    • You may leverage App Service diagnostics from Azure Portal> Navigate to your App Service app in the Azure Portal. (Screenshot below)
    • In the left navigation, click on Diagnose and solve problems and search for “Network Troubleshooter”

    Please check the doc to understand on how -Name resolution that uses your own DNS server - the flow. Checkout this article for more info: Troubleshoot virtual network integration with Azure App Service

    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.