0

I have asp.net core web API and we are using application insight to log request, response, customEvents and exception. In appsettings.json I have added instrumentation key like

"ApplicationInsights": {
    "InstrumentationKey": "xxxx-xxxxxx-xxxxx-xxxxxxx"
  }

I want remove this section and read this key from Keyvalut.

ApplicationInsight instance should be successfully injected through DI in Startup.cs

1 Answers1

0

As the InstrumentationKey is just anither value in the configuration you have few options.

  1. you can create store the InstrumentationKey in the secrets.json file where this file will not be pushed to source control. so the this can be helpful when you are debugging locally.

  2. once the local setup is done, and when you go to publish your app, you can keep the InstrumentationKey in the Web App Configuration in Azure web App, or you can use the Azure App configuration which is provided by Azure (Azure App Configuration) or directly use the Key-Vault.

In order to achieve this you must enable Managed Identities in the Wepp App and grant permission to Access the key-vault.

You can follow this to setup Managed Identities

thanzeel
  • 431
  • 4
  • 12