Skip to content

Instantly share code, notes, and snippets.

@pjbgf
Created June 29, 2018 11:05
Show Gist options
  • Save pjbgf/9bc4a2d24dddd401c80e2b8edc96f054 to your computer and use it in GitHub Desktop.
Save pjbgf/9bc4a2d24dddd401c80e2b8edc96f054 to your computer and use it in GitHub Desktop.
Get all PaaS Host Names from the current Azure subscription
# return all web sites
az resource list --resource-type "Microsoft.Web/sites" --query "[].id" --output tsv |
# query azure for each resource
xargs az resource show --ids |
# define output
jq -r '.[].siteProperties.properties // .[].properties | .enabledHostNames[] // .hostNames | match("^((?!scm).)*$").string'
# return all cloud services
az resource list --resource-type "Microsoft.ClassicCompute/domainNames" --query "[].id" --output tsv |
# query azure for each resource
xargs az resource show --ids |
# define output
jq -r '.[].properties | .hostNames'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment