Query Details

Risk Based Step Up Consent RBSU For Application

Query

AuditLogs
| where OperationName == "Consent to application"
| where parse_json(tostring(TargetResources[0].modifiedProperties))[5].displayName == "ConsentAction.Reason"
| where parse_json(tostring(TargetResources[0].modifiedProperties))[5].newValue contains "Risky application detected"
//Risk Based Step up flow to Admin Flow. This will log even if the permissions being requested are already admin consentable.
//https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/configure-risk-based-step-up-consent
//Ref: https://youtu.be/JBt-sB0qXqk?t=973

Explanation

This KQL query is designed to filter audit logs for specific events related to application consent. Here's a simplified explanation:

  1. AuditLogs: The query starts by looking at the audit logs, which record various actions and events.

  2. Filter by Operation: It specifically looks for logs where the operation performed is "Consent to application," meaning someone has given permission for an application to access certain resources.

  3. Inspect Modified Properties: The query examines the details of the consent action by parsing the JSON data in the modifiedProperties field of the first target resource. It focuses on the sixth property (index 5) which has the display name "ConsentAction.Reason."

  4. Check for Risky Applications: It further filters these logs to find cases where the new value of this property contains the phrase "Risky application detected." This indicates that the consent was given under circumstances where the application was flagged as potentially risky.

  5. Contextual Note: The comments in the query provide additional context. They mention that this is part of a risk-based step-up flow to an admin flow, which logs events even if the permissions requested are already suitable for admin consent. Links to documentation and a video are provided for further understanding.

Overall, this query is used to identify and analyze instances where consent was granted to applications that were flagged as risky, providing insights into potential security concerns.

Details

Jay Kerai profile picture

Jay Kerai

Released: August 7, 2025

Tables

AuditLogs

Keywords

AuditLogsOperationNameTargetResourcesConsentActionReasonApplicationPermissionsAdmin

Operators

AuditLogs|where==parse_jsontostring[].contains

Actions