Tuesday, April 8, 2025

Retrieve custom DNS server settings on VNets using Kusto (KQL)

 You can use Kusto Query Language (KQL) to retrieve information about your Azure environment across subscriptions.

It's a fast tool and very useful in larger environments with many subscriptions and resources.

The following example shows how to list all VNets in the environment including their custom DNS server settings.

Go to Azure Portal -> Azure Resource Graph Explorer

In the query window, add the following KQL:

Resources
where type == "microsoft.network/virtualnetworks"
extend dnsServers = properties.dhcpOptions.dnsServers
project id, name, dnsServers

Click: Run query

Result will look like below (custom DNS only set on one VNet):



You can download the content as a csv and import into xls for sorting and filtering.



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.