Microsoft Entra ID Governance
Governance

Pim How To Use Audit Log

In brief

The documentation explains that related PIM activation and deactivation events can have different CorrelationId values. It recommends using roleAssignmentRequestId to trace a complete request and adds Log Analytics query examples.

What Entra admins need to know

Administrators investigating PIM activity can correlate asynchronous activation and deactivation events more reliably using the documented request ID and queries.

This editorial summary was generated by AI from the documentation changes. Verify important details in the full Microsoft Learn article.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.

Overview

You can use the Microsoft Entra Privileged Identity Management (PIM) Resource audit historylogs to see the role assignment changeschanges, role activations, and activations done through PIM.PIM Policy changes. Data is available for the past 30 days.

The PIM Resource audit log is a subset of Microsoft Entra audit logs. Use Microsoft Entra security and activity reports to view the full audit history of Microsoft Entra ID activity including administrator, end user, and synchronization activity.

If you want to retain audit data for longer than the default retention period, you can use Diagnostic Settings in Azure Monitor to route it to an Azure storage account.account or Log Analytics. For more information, see Archive Microsoft Entra logs to an Azure storage account. To see full audit history of Microsoft Entra ID activity including administrator, end user, and synchronization activity, you can use the Microsoft Entra security and activity reportsIntegrate Microsoft Entra logs with Azure Monitor logs.

Follow these steps to view the audit history for Microsoft Entra roles.

:::image type="content" source="media/pim-how-use-audit-log/my-audit.png" alt-text="Screenshot showing the Audit list page for the current user.":::

Correlating events related to the same activation cycle

CorrelationId is generally used to correlate audit log events related to one request. With PIM, multiple asynchronously processed operations can be part of one activation/deactivation cycle. As a result, some events related to the same activation/deactivation cycle will have different CorrelationIds.

During role activation, the following operations may be processed asynchronously, resulting in multiple CorrelationIds being generated:

  • Scheduled activation in PIM allows eligible users to request role activation to begin at a specified future time. Once scheduled, the system tracks the activation request and automatically creates a role assignment at the designated start time — without requiring further user input. Because this operation is asynchronous, a new CorrelationId is generated at the time of actual activation, which may differ from the original request's CorrelationId. This makes direct correlation using CorrelationId challenging across the request and activation phases.

  • Approval-gated activation: When PIM Policy requires approval for role activation, the activation request follows a two-step process: the request is created by an eligible user, then approval is provided by a designated approver. Once approved, the system proceeds with role assignment — this may happen immediately or later if the user chose a scheduled start. Due to the asynchronous nature of this flow, the CorrelationId may differ across stages.

  • In rare cases, CorrelationId may change during the role activation flow due to the way requests are processed between systems.

Use roleAssignmentRequestId to correlate events related to one activation request in all of the examples above. roleAssignmentRequestId remains the same during the asynchronous processing of operations such as scheduled activation or approval.

Use the following example Log Analytics query to get audit log entries related to role activation:

AuditLogs
| where OperationName has "Add member to role"

Use the output of this query to get the roleAssignmentRequestId for the event you need to analyze.

Use the following example Log Analytics query to get audit log entries related to the same role activation:

let roleAssignmentRequestId = "{roleAssignmentRequestId}";
AuditLogs
| where AdditionalDetails has roleAssignmentRequestId

CorrelationId logged during the deactivation process depends on how deactivation was triggered:

  • When deactivation is triggered automatically based on the expiration of an activated role assignment, CorrelationId of deactivation events matches the latest CorrelationId used during the activation.
  • When deactivation is triggered by the assignee (user selected Deactivate on the portal), CorrelationId will be different from the one used in the activation flow.

In both cases, roleAssignmentRequestId of the original activation request is logged under Additional details for audit log events of deactivation.

Use the following example Log Analytics query to get audit log entries related to the full activation/deactivation cycle:

let roleAssignmentRequestId = "{roleAssignmentRequestId}";
let relatedCorrelationIds = AuditLogs
   | where AdditionalDetails has roleAssignmentRequestId
   | summarize makeset(CorrelationId);
AuditLogs
| where AdditionalDetails has roleAssignmentRequestId
  or CorrelationId in (relatedCorrelationIds)

Next steps

Daily Entra.News

Get daily email updates

Get a concise summary of the latest Microsoft Entra updates delivered straight to your inbox.

Loading the secure signup form…