I found this on msdn blogs since January 7, 2015. Application support for multiple environments, stamps and application versions .
Basically, you can remove the toolkit key from ApplicationInsights.config and put it in Web.config as an application, and then install it at startup.
This means that you can save the configuration for each medium directly in azure.
My steps:
- Remove
<InstrumentationKey> from ApplicationInsights.config Add a parameter to Web.config
<add key="appInsightsInstrumentationKey" value="id_from hre"/>
- Add settings to porta.azure.com for Dev, Sta, etc.
At startup:
var aiInstrumentationKey = System.Web.Configuration.WebConfigurationManager.AppSettings["appInsightsInstrumentationKey"]; if( string.IsNullOrEmpty(aiInstrumentationKey)) { throw new ApplicationException("appInsightsInstrumentationKey missing in web.config"); } Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey = aiInstrumentationKey;
source share