I need to export a list of Application Insights with two columns: Name and Instrumentation Key.
With the following command I get the names, but the column InstrumentationKey is always null.
az resource list --resource-type "Microsoft.Insights/components" --query "[].{Name:name, InstrumentationKey:properties.InstrumentationKey}"
Without filtering the columns, by running simply
az resource list --resource-type "Microsoft.Insights/components"
I can't find the Instrumentation Key.
What is the command to get the Instrumentation Key and relative name for all the resources in a subscription?
CodePudding user response:
After reproducing from my end, I could able to get the expected results using az monitor app-insights component show
. Below is complete Query that worked for me.
$a = az monitor app-insights component show | ConvertFrom-Json
$a | Select-Object name,instrumentationKey
RESULTS: