简体   繁体   中英

How to configure Application Insights for different environments?

I have a multi-tier web application that has been moved to Azure, however I would like to know how I can configure application insights for multiple environments as I have 3 separate resource groups for DEV, QA, and PROD. In each would like to have an instance of application insights to record diagnostic information for each environment but how would I configure this in my application?

There are 2 parts to the answers for your question.

Part 1

As part of the configuring AI(Application Insights) in cloud, you just have to create a new instance in the respective resource groups and Azure will automatically configure it for you.

Now on the overview panel of the instance, get the Application Insights Key or the Instrumentation key . This key will act as an unique identifier to your instance to which you want to send telemetry to.

Part 2

Make use the Microsoft.ApplicationInsights package in your project by installing it.

Have a look at the sample template code here: https://docs.microsoft.com/en-us/azure/azure-monitor/app/console

Note: It is better to keep the Intrumentation key as part of the release variables of your CD pipeline, as it would be easy to manage all the 3 environments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM