Forum Discussion
Determine if appinsight is enabled on appservice
You can use the Azure CLI or Azure Resource Manager (ARM) templates to query the resources associated with your App Service. Here's a general approach to determine if an App Service has an active Application Insights component:
Use Azure CLI to list resources: First, list the resources associated with your App Service using the Azure CLI. You can filter the results to include only resources related to Application Insights.
az resource list --tag Microsoft.Web/serverFarmId="<app_service_id>"
Replace <app_service_id> with the ID of your App Service.
Check for Application Insights resource: Look for an Application Insights resource in the list of resources returned by the command. If an Application Insights resource is listed, it indicates that your App Service is linked to an active Application Insights component.
If no Application Insights resource is found, it means that your App Service does not have an active Application Insights component associated with it.
Automate the process: You can automate this process using scripts or Azure Automation to regularly check the status of Application Insights for your App Services.
Note: This approach assumes that the Application Insights component is directly linked to the App Service. If the linking is done at a higher level (e.g., through an Azure Resource Manager template), additional steps may be required to determine the association.
I just want to share ea response I had from official azure support :
the presence of the application/function setting like :
"APPINSIGHTS_INSTRUMENTATIONKEY" is sufficient to say that the webapp/function
qil ltry to send metrics to appinsight , clearly if the value is wrong it will not work, but the presence of the setting will trigger the runtime to activate application insights.
hope it is useful for everyone
M.