Describe the bug
az monitor app-insights component connect-webapp is used to link a web app to an app insights instance. However, as far as I have been able to find, there is not an automated way of turning on app insights in the web app as you can on the Azure Portal:

Related command
az monitor app-insights component connect-webapp
Errors
There are no errors associated, just missing functionality.
Issue script & Debug output
Currently configuring Azure Monitor as follows:
# create log analytics workspace
az monitor log-analytics workspace create `
--name $LogWorkspace `
--resource-group $ResourceGroup
# create app insights
az monitor app-insights component create `
--app $AppInsights `
--location $Location `
--resource-group $ResourceGroup `
--workspace $LogWorkspace
# connect webapp to app insights
az monitor app-insights component connect-webapp `
--app $AppInsights `
--web-app $AppName `
--resource-group $ResourceGroup
I have tried using az webapp config appsettings to compare the webapp configuration before and after turning on Application Insights.
Adjusting the following configuration values seemed to turn on app insights, but it was not actually receiving telemetry data from my deployed web app:
az webapp config appsettings set `
--name $AppName `
--resource-group $ResourceGroup `
--settings `
ApplicationInsightsAgent_EXTENSION_VERSION=~3 `
XDT_MicrosoftApplicationInsights_Mode=recommended `
APPINSIGHTS_PROFILERFEATURE_VERSION=1.0.0 `
DiagnosticServices_EXTENSION_VERSION=~3 `
APPINSIGHTS_SNAPSHOTFEATURE_VERSION=1.0.0
Expected behavior
One of the following two scenarios:
-
When executing az monitor app-insights component connect-webapp, this should subsequently turn on Application Insights if it is not currently.
-
An az webapp sub-command should allow you to explicitly turn on / off application insights.
Environment Summary
azure-cli 2.64.0
core 2.64.0
telemetry 1.1.0
Extensions:
application-insights 1.2.2
Dependencies:
msal 1.30.0
azure-mgmt-resource 23.1.1
Python location '/opt/az/bin/python3'
Extensions directory '/home/jaime/.azure/cliextensions'
Python (Linux) 3.11.8 (main, Aug 28 2024, 05:45:18) [GCC 11.4.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
No response
Describe the bug
az monitor app-insights component connect-webappis used to link a web app to an app insights instance. However, as far as I have been able to find, there is not an automated way of turning on app insights in the web app as you can on the Azure Portal:Related command
az monitor app-insights component connect-webappErrors
There are no errors associated, just missing functionality.
Issue script & Debug output
Currently configuring Azure Monitor as follows:
I have tried using
az webapp config appsettingsto compare the webapp configuration before and after turning on Application Insights.Adjusting the following configuration values seemed to turn on app insights, but it was not actually receiving telemetry data from my deployed web app:
Expected behavior
One of the following two scenarios:
When executing
az monitor app-insights component connect-webapp, this should subsequently turn on Application Insights if it is not currently.An
az webappsub-command should allow you to explicitly turn on / off application insights.Environment Summary
Additional context
No response