MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.01k stars 21k forks source link

Incorrect advice regarding DNS caching #122197

Closed adamgattsd closed 1 week ago

adamgattsd commented 2 weeks ago

When a backend pool's server is configured with a Fully Qualified Domain Name (FQDN), Application Gateway performs a DNS lookup to get the domain name's IP address(es). The IP value is stored in your application gateway's cache to enable it to reach the targets faster when serving incoming requests.

The Application Gateway retains this cached information for the period equivalent to that DNS record's TTL (time to live) and performs a fresh DNS lookup once the TTL expires.

This information is incorrect. I have AppGw in a vnet with a linked private DNS zone. I updated the DNS records to point to a newer instance of APIM. Hours later the AppGw was still routing to the original APIM instance, despite DNS records having a 3600 TTL. Only after I made a slight edit to the Backend pool was the DNS change recognised by AppGw and traffic forwarding update.

[Enter feedback here]


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

PesalaPavan commented 2 weeks ago

@adamgattsd Thanks for your feedback! We will investigate and update as appropriate.

ManoharLakkoju-MSFT commented 1 week ago

@adamgattsd I'm sorry to hear that you experienced an issue with the DNS caching behavior of Application Gateway. While Application Gateway does cache DNS lookup results, it should refresh the cache once the TTL expires and perform a fresh DNS lookup. However, there may be situations where the cache is not refreshed as expected.

In your case, it seems that making a slight edit to the Backend pool forced Application Gateway to recognize the DNS change and update the traffic forwarding. This behavior is not expected, and I apologize for any inconvenience it may have caused.

If you encounter similar issues in the future, you can try restarting the Application Gateway to force it to refresh the DNS cache. You can do this with Azure CLI:

az network application-gateway stop --resource-group myRG --name myAppGw
az network application-gateway start --resource-group myRG --name myAppGw

I hope this helps! Let me know if you have any other questions.

ManoharLakkoju-MSFT commented 1 week ago

@adamgattsd We are going to close this thread as resolved but if there are any further questions regarding the documentation, please tag me in your reply and we will be happy to continue the conversation