Query Details
//This query looks at the justification descriptions given for approval per role. use this to check users are PIM'ing up for the right roles for the right tasks // Where users have repeated the same justification over and over could indicate that they may have tried to script their PIM elevations. #TODO join "Add member to role request approved (PIM activation)" to pull approver (RequestID = tostring(AdditionalDetails[7].value)) AuditLogs | where TimeGenerated > ago(90d) | where OperationName == "Add member to role requested (PIM activation)" | extend Role = tostring(TargetResources[0].displayName) | extend TicketNumber = tostring(AdditionalDetails[7].value) | summarize by ResultReason , tostring(parse_json((InitiatedBy.user)).userPrincipalName), Role, TicketNumber
This KQL (Kusto Query Language) query is designed to analyze audit logs related to role activation requests in a Privileged Identity Management (PIM) system. Here's a simple breakdown of what the query does:
Data Source: It starts by looking at the AuditLogs table.
Time Filter: The query filters the logs to include only those generated in the last 90 days.
Operation Filter: It specifically looks for logs where the operation name is "Add member to role requested (PIM activation)," which indicates requests to activate a role.
Extract Information:
TargetResources field.AdditionalDetails field.Summarization: The query summarizes the data by:
ResultReason).Purpose: The goal is to review the justifications provided for role activations to ensure users are requesting the correct roles for appropriate tasks. Repeated justifications might suggest that users are automating their role activation requests, which could be a concern.
Future Enhancement: There's a note to join this data with another log entry type ("Add member to role request approved") to include information about who approved the request, using the RequestID for matching.
Overall, this query helps in auditing and ensuring the proper use of role activation requests within a PIM system.

Jay Kerai
Released: November 30, 2024
Tables
Keywords
Operators