Forum Discussion
Determine if appinsight is enabled on appservice
thanks for your reply what you describe makes sense, but in my case I do not want to interact with the portal, and I do not know in advance the name/details of the appinsight component.
From the portal I can see that if I select an app service. there is an appinsight section , so I would like to find a way to get the same information via cli/api ; so to recap I have an app service with full details /(name , resource group , id) I want to know if this app service has an active appinsight.
I'm actively checking for a solution so If I'll be able to find a solution I'll post an update
thank you
M.
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.
- MarioalessiocarusoApr 30, 2024Copper ContributorHello,
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.