Entra PIM Privileged Session Monitoring, AI Least-Privilege Recommendations & Standing Admin Cleanup (Graph PowerShell Runbook)

✨ Identity Governance Brief — Entra PIM Public Preview Wave (Post-Ignite 2026)
  • What's in preview: Microsoft Entra Privileged Identity Management is adding privileged session monitoring and session recordings, Security Copilot-driven least-privilege role recommendations at activation time, a PIM-only mode to block out-of-band role assignments, and bulk tools to reduce standing access.
  • Why it matters now: None of these controls help if admins still hold permanent active roles. Session monitoring and AI recommendations only fire on PIM activations—standing Global Administrators bypass them entirely.
  • First step (live-tested): Run the Graph PowerShell audit below to split every directory role assignment into Permanent Active, Time-bound Active and Eligible, flag privileged roles and service principals, and produce a conversion backlog before enabling PIM-only mode.

At Ignite 2026, Microsoft announced a substantial expansion of Microsoft Entra Privileged Identity Management (PIM), now rolling out in public preview. The headline features—session monitoring and recordings, AI-based least-privilege recommendations through Microsoft Security Copilot, and PIM-only mode—all share one prerequisite: your privileged roles must actually flow through PIM activation.

In our own LAB 365 dev tenant, the audit below found 18 permanent active role assignments against only 13 eligible ones, including six permanent Global Administrators, two service principals holding permanent Exchange directory roles, and two role-assignable groups with standing admin roles. That is typical of most tenants—and exactly the gap this runbook closes.

For PIM on application roles and AI agent identities (Graph appRoleAssignments), see our companion guide: Enhanced Entra PIM for Application Roles & AI Agent Identities.

Architecture: From Standing Access to Monitored Just-in-Time Elevation

1. Standing Access • Permanent Global Admins • SPs with Directory Roles • Out-of-band assignments Bypasses PIM controls 2. Graph Audit roleAssignmentScheduleInstances roleEligibilityScheduleInstances Classify: Permanent / JIT Conversion backlog CSV 3. Convert to Eligible • Keep 2 break-glass accts • adminAssign eligibility • adminRemove active Then enable PIM-only mode 4. Monitored JIT ✔ Session recording ✔ AI role suggestion ✔ Approval + MFA Full audit trail Licensing note: PIM requires Microsoft Entra ID P2 or Entra ID Governance for users who benefit from it. Security Copilot recommendations additionally require Security Copilot capacity (SCUs). Preview features may change before GA.

1. What's New in the Entra PIM Preview Wave

CapabilityWhat it doesPrerequisite you must fix first
Privileged session monitoring & recordingsLets security teams watch and review what happened during an elevated session, including JIT connections to Azure / Azure Arc VMs from My Access.Admins must elevate through PIM—permanent roles produce no session to monitor.
AI least-privilege recommendations (Security Copilot)At activation, Copilot reads the justification (e.g. "read the activity logs") and suggests a narrower role; admins can allow users to activate a subset role under a broader eligibility.Eligible (not active) assignments, and good justification hygiene.
PIM-only modeBlocks role assignments made outside PIM so drift can't reappear.Clean baseline—otherwise legitimate automation breaks on day one.
Bulk standing-access reductionConvert many permanent assignments at scale.An accurate inventory (the script below).

2. Live-Tested Audit: Permanent vs Time-bound vs Eligible Role Assignments

This script uses only Microsoft Graph REST via Invoke-MgGraphRequest, so it works with the base Microsoft.Graph.Authentication module. It requires RoleManagement.Read.Directory (or RoleManagement.ReadWrite.Directory) and was tested app-only with certificate auth against the LAB 365 tenant.

POWERSHELL
#Requires -Modules Microsoft.Graph.Authentication
<#
.SYNOPSIS
    Classifies every Entra directory role assignment as Permanent Active, Time-bound Active,
    or Eligible, and flags privileged roles and service principals for PIM conversion.
#>
param(
    [string]$ClientId,
    [string]$TenantId,
    [string]$CertificateThumbprint,
    [string]$OutputCsv = ".\Entra-PIM-Standing-Access-$(Get-Date -Format 'yyyyMMdd').csv"
)

if ($ClientId -and $TenantId -and $CertificateThumbprint) {
    Connect-MgGraph -ClientId $ClientId -TenantId $TenantId -CertificateThumbprint $CertificateThumbprint -NoWelcome
} else {
    Connect-MgGraph -Scopes "RoleManagement.Read.Directory" -NoWelcome
}

function Get-GraphAll([string]$Uri) {
    $items = [System.Collections.Generic.List[object]]::new()
    while ($Uri) {
        $page = Invoke-MgGraphRequest -Method GET -Uri $Uri -OutputType PSObject
        $page.value | ForEach-Object { $items.Add($_) }
        $Uri = $page.'@odata.nextLink'
    }
    return $items
}

# Tier-0 / high-impact roles to prioritise (extend for your tenant)
$PrivilegedRoles = @(
    "Global Administrator", "Privileged Role Administrator", "Privileged Authentication Administrator",
    "Security Administrator", "Conditional Access Administrator", "Exchange Administrator",
    "SharePoint Administrator", "User Administrator", "Application Administrator",
    "Cloud Application Administrator", "Hybrid Identity Administrator", "Intune Administrator",
    "Authentication Administrator", "Helpdesk Administrator", "Exchange Recipient Administrator"
)

$RoleNames = @{}
Get-GraphAll "https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?`$select=id,displayName" |
    ForEach-Object { $RoleNames[$_.id] = $_.displayName }

$Active   = Get-GraphAll "https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignmentScheduleInstances?`$expand=principal"
$Eligible = Get-GraphAll "https://graph.microsoft.com/v1.0/roleManagement/directory/roleEligibilityScheduleInstances?`$expand=principal"

$Report = foreach ($a in $Active) {
    $role = $RoleNames[$a.roleDefinitionId]
    [PSCustomObject]@{
        Role          = $role
        Privileged    = $PrivilegedRoles -contains $role
        Principal     = $a.principal.displayName
        PrincipalType = ($a.principal.'@odata.type' -replace '#microsoft.graph.', '')
        State         = if ($a.assignmentType -eq 'Activated') { 'Activated (JIT)' }
                        elseif (-not $a.endDateTime)        { 'Permanent Active' }
                        else                                { 'Time-bound Active' }
        MemberType    = $a.memberType
        EndDateTime   = $a.endDateTime
        Scope         = $a.directoryScopeId
    }
}
$Report += foreach ($e in $Eligible) {
    $role = $RoleNames[$e.roleDefinitionId]
    [PSCustomObject]@{
        Role          = $role
        Privileged    = $PrivilegedRoles -contains $role
        Principal     = $e.principal.displayName
        PrincipalType = ($e.principal.'@odata.type' -replace '#microsoft.graph.', '')
        State         = 'Eligible'
        MemberType    = $e.memberType
        EndDateTime   = $e.endDateTime
        Scope         = $e.directoryScopeId
    }
}

$Report | Sort-Object Privileged, State -Descending | Export-Csv $OutputCsv -NoTypeInformation -Encoding UTF8

Write-Host "`n=== PIM Readiness Summary ===" -ForegroundColor Cyan
$Report | Group-Object State | Select-Object Name, Count | Format-Table -AutoSize
Write-Host "Permanent privileged assignments (conversion backlog):" -ForegroundColor Yellow
$Report | Where-Object { $_.State -eq 'Permanent Active' -and $_.Privileged } |
    Format-Table Role, Principal, PrincipalType -AutoSize

Sample output from the LAB 365 tenant (names abbreviated):

TEXT
=== PIM Readiness Summary ===
Name             Count
----             -----
Permanent Active    18
Eligible            13

Permanent privileged assignments (conversion backlog):
Role                             Principal                PrincipalType
----                             ---------                -------------
Exchange Recipient Administrator EXO-FunctionApp          servicePrincipal
Global Administrator             (6 user accounts)        user
Exchange Administrator           LAB365-Dev-Automation    servicePrincipal
Exchange Recipient Administrator Messaging Team L2        group
Helpdesk Administrator           ROL-APAC-Helpdesk-Admins group
Groups: Role-assignable groups with permanent roles can be onboarded to PIM for Groups, so membership itself becomes eligible and time-bound.
Note: Service principals cannot activate PIM roles interactively. For automation identities like EXO-FunctionApp, replace the directory role with a scoped Exchange RBAC for Applications assignment or a least-privileged Graph application permission instead of converting it to eligible.

3. Converting a Permanent Assignment to Eligible (Graph)

After you've confirmed which accounts must stay permanent (normally two cloud-only break-glass accounts excluded from Conditional Access and monitored by alerts), convert the rest. Create the eligibility first, then remove the active assignment:

POWERSHELL
$PrincipalId = "<user-object-id>"
$RoleId      = "62e90394-69f5-4237-9190-012177145e10"  # Global Administrator template ID

# 1. Create a 180-day eligible assignment
$eligibleBody = @{
    action           = "adminAssign"
    justification    = "PIM conversion - CAB-2026-1204"
    roleDefinitionId = $RoleId
    directoryScopeId = "/"
    principalId      = $PrincipalId
    scheduleInfo     = @{
        startDateTime = (Get-Date).ToUniversalTime().ToString("o")
        expiration    = @{ type = "afterDuration"; duration = "P180D" }
    }
} | ConvertTo-Json -Depth 5
Invoke-MgGraphRequest -Method POST -Uri "https://graph.microsoft.com/v1.0/roleManagement/directory/roleEligibilityScheduleRequests" -Body $eligibleBody

# 2. Remove the permanent active assignment
$removeBody = @{
    action           = "adminRemove"
    justification    = "PIM conversion - CAB-2026-1204"
    roleDefinitionId = $RoleId
    directoryScopeId = "/"
    principalId      = $PrincipalId
} | ConvertTo-Json
Invoke-MgGraphRequest -Method POST -Uri "https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignmentScheduleRequests" -Body $removeBody
Safety: Always run step 1 and verify the eligibility appears in Entra admin center → ID Governance → Privileged Identity Management → My roles for the target user before running step 2. Never convert your last permanent Global Administrator.

4. Rollout Checklist for the Preview Features

  1. Configure role settings for Tier-0 roles: require MFA (or an authentication strength such as phishing-resistant passkeys), justification, approval, and a maximum activation of 1–4 hours.
  2. Pilot session monitoring on a small set of Azure / Azure Arc VMs reached through My Access before widening scope.
  3. Enable "Allow least-privilege role activation" only for roles where a subset role makes sense (for example, Owner → Reader for log review). Review Copilot's suggestions against your own RBAC model.
  4. Turn on PIM-only mode last, after the audit shows zero unexpected permanent assignments and automation has moved to app permissions.
  5. Re-run the audit weekly (Azure Automation with certificate auth) and alert on any new Permanent Active privileged row.


References & Official Microsoft Documentation

đź’¬ Reader Comments & Feedback

Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.