Identify unused high privileged application permissions
Description
The query below identifies unused high privileged application permissions. These permissions can be revoked from the application to adhere to the least privileged principle.
Query · kql
OAuthAppInfo | summarize arg_max(Timestamp, *) by OAuthAppId | mv-expand Permissions | extend PermissionValue = tostring(Permissions.PermissionValue), InUse = tobool(Permissions.InUse), PrivilegeLevel = tostring(Permissions.PrivilegeLevel) | where InUse == false and PrivilegeLevel == "High" | summarize TotalMailPermissions = dcount(PermissionValue), Permissions = make_set(PermissionValue) by OAuthAppId, AppName, AppOrigin