Hello @BhargaviAnnadevara-MSFT ,
The CLI link you provided has nothing related to "Enable Application Insights integration with App Service" at all.
Also, the other two links that you provided are incomplete, and does not pose any viable "Application Insights Integration".
They do not provide any reasonable or viable means to enable/disable "Application Insights Integration" properties. For example, there are "Recommended" configurations that you can choose and configure on the portal are not provided or explained.
Hello @Sven Saatkamp ,
Although you can mock some application settings to partially facilitate this, unfortunately there is no "Enable Application Insights integration with App Service Diagnostics" that Microsoft provides via ARM Template, PowerShell or CLI at the time of this publishing.
If you try to "export a template" from an existing app service that is integrated with Application Insights, you see that the "Application Insights Integration" related configurations are completely ignored from the generated template as of today.
The option people like ourselves are left with is:
- Configure a desired Application Insights - App Service integration
- Go to Configuration > Application Settings > Advanced Edit for the App Service
- Try to figure out as much as you can to get the correct Application Setting names and values that pertain to your desired Application Insights configuration
- Use your favorite tool to transform and apply these application settings
I think it is a shame that there is no proper programmatic way of doing this.
I copied the relevant app settings that I could locate below for convenience.
Hope that helps.
Note:
Even though you mark the Application Insight related app settings with "slotSetting"=false, these settings will not auto-magically propagate to your existing deployment slots. If you browse to the deployment slots and check Application Insights, they will show as not enabled.
Good luck, and best regards.
Relevant App Settings:
[
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "<yourkey>",
"slotSetting": false
},
{
"name": "APPINSIGHTS_PROFILERFEATURE_VERSION",
"value": "disabled",
"slotSetting": false
},
{
"name": "APPINSIGHTS_SNAPSHOTFEATURE_VERSION",
"value": "disabled",
"slotSetting": false
},
{
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
"value": "InstrumentationKey=<yourkey>;IngestionEndpoint=https://<yourregionprefix>.in.applicationinsights.azure.com/",
"slotSetting": false
},
{
"name": "ApplicationInsightsAgent_EXTENSION_VERSION",
"value": "~2",
"slotSetting": false
},
{
"name": "DiagnosticServices_EXTENSION_VERSION",
"value": "disabled",
"slotSetting": false
},
{
"name": "InstrumentationEngine_EXTENSION_VERSION",
"value": "~1",
"slotSetting": false
},
{
"name": "SnapshotDebugger_EXTENSION_VERSION",
"value": "disabled",
"slotSetting": false
},
{
"name": "XDT_MicrosoftApplicationInsights_BaseExtensions",
"value": "~1",
"slotSetting": false
},
{
"name": "XDT_MicrosoftApplicationInsights_Java",
"value": "1",
"slotSetting": false
},
{
"name": "XDT_MicrosoftApplicationInsights_Mode",
"value": "recommended",
"slotSetting": false
},
{
"name": "XDT_MicrosoftApplicationInsights_NodeJS",
"value": "1",
"slotSetting": false
},
{
"name": "XDT_MicrosoftApplicationInsights_PreemptSdk",
"value": "disabled",
"slotSetting": false
}
]