Skip to content

Instantly share code, notes, and snippets.

@tomasr
Created February 19, 2016 19:19
Show Gist options
  • Save tomasr/6f91214fc6a5de4cb535 to your computer and use it in GitHub Desktop.
Save tomasr/6f91214fc6a5de4cb535 to your computer and use it in GitHub Desktop.
Get Application Insights Instrumentation Keys
Function Get-AIInstrumentationKeys() {
Get-AzureRmResource |
Where-Object { $_.ResourceType -eq 'Microsoft.Insights/components' } |
ForEach-Object {
$aiObj = Get-AzureRmResource -ResourceId $_.ResourceId
Write-Output ([pscustomobject]@{
ResourceGroup = $aiObj.ResourceGroupName;
ResourceName = $aiObj.ResourceName;
InstrumentationKey = $aiObj.Properties.InstrumentationKey
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment