Query Details
//This query provides insights about service principal sign-in requests, resources, and source IPs //Useful for analyzing service principal usage before implementing IP restrictions with conditional access let LookbackPeriod = 365d; AADServicePrincipalSignInLogs | where TimeGenerated > ago(LookbackPeriod) | summarize make_set(IPAddress), RequestCount = count() by ServicePrincipalName, ResourceDisplayName | order by RequestCount desc
This query is designed to analyze the sign-in activity of service principals over the past year (365 days). It retrieves data from the AADServicePrincipalSignInLogs and performs the following steps:
make_set(IPAddress)) from which the sign-ins originated.RequestCount).This query is particularly useful for understanding how service principals are being used, which can help in planning and implementing IP restrictions through conditional access policies.

Lukasz Kozubal
Released: November 10, 2024
Tables
Keywords
Operators