Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JohnLBevan/a4779e4d488bde5d266eb5630b6dc271 to your computer and use it in GitHub Desktop.
Save JohnLBevan/a4779e4d488bde5d266eb5630b6dc271 to your computer and use it in GitHub Desktop.
A kusto query which can be run under the Azure Resource Graph Explorer (https://portal.azure.com/#view/HubsExtension/ArgQueryBlade) to get a list of hostnames/listeners configured on all app gateways under your subscriptions.
(
resourcecontainers
| where type =~ 'microsoft.resources/subscriptions'
| project SubscriptionName=name, subscriptionId
) | join kind = inner
(
resources
| where type =~ 'microsoft.network/applicationgateways'
| project subscriptionId, AppGateway=name, httpListeners = properties['httpListeners']
) on subscriptionId
| mv-expand httpListeners
| project SubscriptionName
, AppGateway
, Listener = httpListeners.name
, Protocol = httpListeners.properties.protocol
, SingleHostName = httpListeners.properties.hostName
, HostNames = httpListeners.properties.hostNames
| mv-expand HostName = coalesce(SingleHostName, HostNames)
| project-away SingleHostName, HostNames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment