So I had an application recently that needed to use AppInsights. The application was deployed using Visual Studio Release Management so everything needed to be deployed using the Azure Resource Management template.
Problem
You can’t specify an instrumentation key. It is created automatically upon creation.
Solution
Retrieve the key directly from within the template.
Here’s a trimmed down version of an ARM template that does exactly this.
1 | { |
Key piece
See that little AppSettings named InstrumentationKey
? That’s where the magic happens.
Your instrumentation key is now bound to your WebApp AppSettings without carrying magic strings.