Resource Graph Explorer - KQL queries for Azure APP services - Application Insights enabled or disabled

Ieuan Walker 30 Reputation points
2024-10-25T11:41:45.0333333+00:00

Id like a kusto query to be able to return whether application insights is enabled or disabled in the app services.

I can list the appservices in using a simple query, but cant seem to find the application insights settings -

resources
| where type == "microsoft.web/sites"

I would like this query as we have application insights installed within the app via the SDK we dont need it enabled on the appservice as this is consuming more resources.

We have a lot of apps so would like the query to be able to see all the apps with it still enabled and be able to keep monitoring it in the future.User's image

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,392 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,962 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 21,991 Reputation points Microsoft Employee
    2024-10-26T08:54:08.8966667+00:00

    @Ieuan Walker Thanks for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this,

    I understand that you are looking for a resource graph explorer query to check whether app service is enabled with application insights or not.

    Ideally, when you enable the app insights to a particular app service, the instrumentation key of app insight instance will be stored as application setting in app service.

    All the app service siteConfig properties will be stored in appserviceresources table

    In order to meet your requirement, you need to create the query using both resources & appserviceresources tables as shown below.

    Here is the sample query which helps to pull the list of app service with no application insights enabled.

    
    resources
    | where type == "microsoft.web/sites" and ['kind']  in ( "app","app,linux","app,linux,container","app,container,windows") 
    | join ( appserviceresources) on $left.name == $right.name
    | project properties1.AppSettings,name,resourceGroup1 
    | where properties1_AppSettings !contains "APPLICATIONINSIGHTS"
    

    Note: Please do modify the above query based on your requirement.

    Hope this helps, let me know if you have any further questions on this.

    Please accept as "Yes" if the answer is helpful so that it can help others in the community.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.