Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronhoffman/cf5bd0c59216b3e6a57c0c6ea134cafb to your computer and use it in GitHub Desktop.
Save aaronhoffman/cf5bd0c59216b3e6a57c0c6ea134cafb to your computer and use it in GitHub Desktop.
list all azure app insights resources and Instrumentation Keys powershell script Azure Az
# more info https://aaron-hoffman.blogspot.com/2020/12/Find-Azure-Application-Insights-Resource-by-InstrumentationKey.html
# for each subscription in context
foreach ($subId in (Get-AzSubscription).Id | Get-Unique) {
write-host "Subscription $subId"
# set context to the given subId
Set-AzContext -SubscriptionId $subId
# List the name and InstrumentationKey of all Application Insights resources in this sub
Get-AzResource -ResourceType Microsoft.Insights/components -ExpandProperties | select -ExpandProperty Properties | select Name, InstrumentationKey | ft
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment