Using Terraform, how do you enable Application Insights agent-based monitoring for
Azure App Service (.NET Core 2.x) Azure Function App (.NET Core 2.x)
To enable the Application Insights agent-based monitoring for Azure App Service (.NET Core 2.x) Azure Function App (.NET Core 2.x), you just need to add the environment variable for application insight in the app setting like below:
In Azure portal:
In terraform:
app_settings = {
"APPINSIGHTS_INSTRUMENTATIONKEY" = "${azurerm_application_insights.example.instrumentation_key}"
}
The result shows the logs for the function "functioninsighttest":
Apparently now in 2021 there are two ways to this.
The second one is:
app_settings = {
"MSDEPLOY_RENAME_LOCKED_FILES" = "1"
"WEBSITE_HEALTHCHECK_MAXPINGFAILURES" = "10"
"ASPNETCORE_ENVIRONMENT" = "Development"
"APPINSIGHTS_INSTRUMENTATIONKEY" = azurerm_application_insights.appi1.instrumentation_key
"APPLICATIONINSIGHTS_CONNECTION_STRING" = azurerm_application_insights.appi1.connection_string
"APPINSIGHTS_PROFILERFEATURE_VERSION" = "1.0.0"
"APPINSIGHTS_SNAPSHOTFEATURE_VERSION" = "1.0.0"
"ApplicationInsightsAgent_EXTENSION_VERSION" = "~2"
"DiagnosticServices_EXTENSION_VERSION" = "~3"
"InstrumentationEngine_EXTENSION_VERSION" = "disabled"
"SnapshotDebugger_EXTENSION_VERSION" = "disabled"
"XDT_MicrosoftApplicationInsights_BaseExtensions" = "disabled"
"XDT_MicrosoftApplicationInsights_Java" = "1"
"XDT_MicrosoftApplicationInsights_Mode" = "recommended"
"XDT_MicrosoftApplicationInsights_NodeJS" = "1"
"XDT_MicrosoftApplicationInsights_PreemptSdk" = "disabled"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With