D J
D J

Reputation: 1

Azure - DNS Hostname Resolution from App Service Plan using VNet Integration

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

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?

All outbound traffic is enabled in the VNet Integration to go into the VNet.

Upvotes: 0

Views: 1275

Answers (1)

SiddheshDesai
SiddheshDesai

Reputation: 8195

Make sure your API hosted in a VM and Web app are in the same V-NET and there's a dedicated subnet created for Web App while integrating the Web app with the V-NET.

enter image description here

enter image description here

enter image description here

Referring to ajkuma suggestions in this MS Q & A Forum:- DNS Hostname Resolution from App Service Plan using VNet Integration - Microsoft Q&A

  1. Check the kudu DebugConsole in Left pane Advance tools of your web app https://.scm.azurewebsites.net/DebugConsole and run the commands :- nameresolver to verify if the hostname is returning the correct IP address. If it fails use nameresolver domain IPofDNSServer and Nameresolver.exe which is the alternative of nslookup :-

enter image description here

enter image description here

In order to troubleshoot the issue you can visit > your App > Diagnose and solve problems > Diagnostic Tools >

enter image description here

Select Connection issues and check the recommendation for more insights.

enter image description here

I created one API in my Azure VM refer below:-

enter image description here

Called that API from azure Web app as Azure Web app has V-NET integrated with VM.

Make sure you have your DNS cache is cleared by running the below command in your debug console:-

ipconfig /flushdns

Make sure your Web app code has correct connection string to connect to your API.

Also, Validate if your DNS is resolving to the correct hostname of your API.

For Private DNS Zone make sure its resolving correctly with your API and then configure the same V-NET as your Web app with the Private DNS zone.

Reference:-

Azure App Service virtual network integration troubleshooting guide - Azure | Microsoft Learn

azure-docs/virtual-networks-name-resolution-for-vms-and-role-instances.md at main · MicrosoftDocs/azure-docs · GitHub

Upvotes: 0

Related Questions