1

I would like to link diagnostic data from an azure resource to Application Insights which is similarly described here: https://learn.microsoft.com/en-us/azure/cloud-services/cloud-services-dotnet-diagnostics-applicationinsights#configure-azure-diagnostics-to-send-data-to-application-insights

However, I would like to set up this data sending with automated deployments such as an ARM template or Azure CLI.

Cat
  • 21
  • 1

1 Answers1

0

By configuring Application Insights, Visual Studio adds an InstrumentationKey tag in ApplicationInsights.config file.

<InstrumentationKey>xxxx-xxxx-xxxx-xxxx-xxxx</InstrumentationKey>

Instrumentation Key is unique for each resource you want to send data to Application Insights. Following steps can be followed:

  1. Pre-generate Instrumentation Key for production environment (follow doc)
  2. Create environment specific ApplicationInsights.config like Web.config.
  3. CI-CD will pick environment specific config file.

Note - You can even automate Step# 1 as initial step in CI-CD pipeline using PowerShell scripts. And another step to modify config file accordingly, again using PowerShell.

Edit - After comments it is known that some diagnostics log from Stream Analytics need to be sent to Application Insights. I would recommend using Azure Functions along with Stream Analytics. Azure Functions can send data to App Insights. It will depend on how diagnostic log is getting generated.

Any Azure deployment can be done using ARM templates. Or you can create this set up on Dev environment and then export the ARM template, edit it for other environments.

Sarvesh Gupta
  • 85
  • 3
  • 9
  • If I don't use visual studio, where do I put the ApplicationInsights.config, and how do I put it there? – Cat May 16 '17 at 08:16
  • Are you configuring App Insights for Cloud Services or App Services or something else! – Sarvesh Gupta May 16 '17 at 08:41
  • I am hoping to configure it for stream analytics where the diagnostic logs are sent to app insights. – Cat May 16 '17 at 09:19
  • I would recommend using Azure Functions along with Stream Analytics. Azure Functions can send data to App Insights. It will depend on how diagnostic log is getting generated. If it is custom generated then follow something like https://learn.microsoft.com/en-us/azure/stream-analytics/stream-analytics-functions-redis – Sarvesh Gupta May 16 '17 at 09:36