Forum Discussion
Determine if appinsight is enabled on appservice
To use the Azure API Management REST API to check if Application Insights is enabled for an Azure App Service (including Function Apps), you can follow these steps:
Get the Subscription ID and Resource Group Name:
You'll need the Subscription ID and Resource Group Name where your Azure App Service is located.
Get the Azure App Service ID:
You'll need the ID of your Azure App Service. You can find this by navigating to the Azure portal, selecting your App Service, and copying the ID from the URL. It will look something like this:
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{appName}
Get the Application Insights Component ID:
You'll need the ID of the Application Insights component associated with your App Service. You can find this in the Azure portal by navigating to your App Service, selecting "Application Insights" under Monitoring, and copying the Instrumentation Key from the overview page. The Instrumentation Key is part of the Application Insights Component ID.
Check if Application Insights is Enabled:
Use the Azure API Management REST API to check if Application Insights is enabled for your App Service. You can do this by making a GET request to the following endpoint:
https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{appInsightsComponentId}?api-version=2015-05-01
Replace {subscriptionId}, {resourceGroupName}, and {appInsightsComponentId} with your Subscription ID, Resource Group Name, and Application Insights Component ID, respectively.
If the GET request returns a successful response (200 OK), it means Application Insights is enabled for your App Service.
Please note that you'll need to authenticate your API requests using Azure AD credentials with appropriate permissions to access the Azure API Management API.