Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I retrieve the instrumentation key for an Application Insights instance in an Azure Resource Group Template?

Is there any way to retrieve the Instrumentation Key for an Application Insights instance in an Azure Resource Group template ?

I've tried the instructions here to retrieve the list of list* operations available on Azure resources, but Microsoft.Insights/components doesn't appear in the list anywhere. It's making me think that retrieving an Instrumentation Key in the template isn't currently possible

like image 739
Alex Marshall Avatar asked Sep 06 '25 12:09

Alex Marshall


1 Answers

After some digging and experimenting, this is what I found works:

"outputs": {
    "MyAppInsightsInstrumentationKey": {
        "value": "[reference(resourceId('Microsoft.Insights/components', variables('myAppInsightsInstanceName')), '2014-04-01').InstrumentationKey]",
        "type": "string"
    }
}
like image 181
Alex Marshall Avatar answered Sep 11 '25 11:09

Alex Marshall