Managing Roles with Privileged Identity Management

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 10 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Managing Roles with Microsoft Entra Privileged Identity Management (PIM)

Introduction: The Philosophy of Least Privilege

In the modern enterprise, the identity is the new perimeter. As organizations migrate their infrastructure and productivity suites to the cloud, the traditional model of "permanent administrative access" has become a significant liability. When a user account is assigned a highly privileged role—such as Global Administrator or Exchange Administrator—that access is typically active 24/7. If that account is compromised through phishing, credential stuffing, or session hijacking, the attacker gains immediate and unrestricted access to the entire environment. This is where Privileged Identity Management (PIM) becomes essential.

Privileged Identity Management is a service within Microsoft Entra ID (formerly Azure AD) that enables you to manage, control, and monitor access to important resources in your organization. Instead of granting permanent access, PIM allows you to provide "just-in-time" (JIT) access. This means that a user only gains the permissions they need for the specific window of time they need them, and only after fulfilling specific requirements like Multi-Factor Authentication (MFA) or manager approval. By moving from permanent, standing access to time-bound, audited access, you significantly reduce the attack surface of your Microsoft 365 tenant.

This lesson explores how to design, implement, and manage a PIM strategy. We will move beyond the basic interface and look at the architectural requirements, the operational workflow for administrators, and the auditing mechanisms that ensure your environment remains secure over the long term.


Not read yet

The Core Concepts of PIM

To effectively manage roles with PIM, you must first understand the distinction between "eligible" and "active" assignments. In a standard Microsoft 365 environment, an assignment is binary: you either have the role or you do not. With PIM, we introduce the concept of eligibility.

Eligible Assignments

When a user is assigned an "eligible" role, they do not have the permissions of that role by default. The role is essentially "dormant" until the user initiates an activation process. This is the ideal state for most administrative accounts. Even if the account is compromised, the attacker cannot perform administrative actions because the role has not been activated.

Active Assignments

"Active" assignments in PIM function similarly to traditional assignments, but with the added benefit of time-bounding. You might assign an administrator the "Helpdesk Administrator" role for a fixed duration of three months for a specific project. Once the time expires, PIM automatically removes the assignment. This prevents "permission creep," where users retain access to systems long after they have moved to different departments or finished their projects.

Callout: PIM vs. Standard RBAC Standard Role-Based Access Control (RBAC) is static. You assign a role, and the user keeps it until you manually remove it. PIM introduces a dynamic layer on top of RBAC. It forces a workflow—authentication, approval, and time-limits—before the RBAC permission is actually applied to the user's security token.


Not read yet

Implementing PIM: A Step-by-Step Guide

Before you can use PIM, you must ensure you have the correct licensing. PIM requires Microsoft Entra ID P2 licenses for the users who will be using the features. Once licensing is in place, the setup process follows a logical progression of discovery, policy configuration, and assignment.

1. Enabling PIM for Your Tenant

PIM is generally available in the Microsoft Entra admin center. You do not need to "install" it, but you do need to configure the initial settings. Navigate to the "Privileged Identity Management" blade in the Entra portal. The first time you access this, you may be prompted to provide consent for the service to manage your directory.

2. Defining Role Settings

Before assigning roles, you must define the "rules of engagement." These rules dictate what happens when a user requests to activate a role. You can customize these settings for each specific role (e.g., Global Administrator vs. User Administrator).

  • Activation Duration: How long can a user hold the role? (Default is often 4 hours).
  • MFA Requirement: Does the user need to perform an additional MFA challenge to activate the role? (Highly recommended).
  • Approval Requirements: Does the user need a human reviewer to approve the request before the role is granted?
  • Justification/Ticket Number: Should the user be required to provide a business reason or a service desk ticket number?

3. Configuring Role Assignments

Once the policies are set, you can start assigning users to roles as "Eligible."

  1. Navigate to Privileged Identity Management > Azure AD roles.
  2. Select Assignments > Add assignments.
  3. Choose the role (e.g., SharePoint Administrator).
  4. Select the member (the user or group).
  5. Set the assignment type to Eligible.
  6. Define the duration (or set it to permanent eligibility).

Note: While you can set permanent eligibility, it is a best practice to set an expiration date for the eligibility itself. For example, a user might be eligible for a role for one year, after which their access must be reviewed and renewed.


Not read yet

Automating PIM with PowerShell

For larger organizations, managing PIM through the portal is inefficient. You can use the Microsoft.Graph PowerShell module to automate assignments. This is particularly useful for provisioning access during onboarding or integrating with your internal ticketing system.

Example: Assigning an Eligible Role

The following script demonstrates how to assign an eligible role to a user. You will need the Directory.ReadWrite.All and RoleManagement.ReadWrite.Directory permissions.

# Connect to Microsoft Graph
Connect-MgGraph -Scopes "RoleManagement.ReadWrite.Directory"

# Define variables
$userId = "user-guid-here"
$roleDefinitionId = "role-guid-here" # e.g., Global Admin GUID
$startTime = (Get-Date).ToString("yyyy-MM-ddTHH:mm:ssZ")

# Create the eligible assignment
New-MgRoleManagementDirectoryRoleAssignmentScheduleRequest -RoleDefinitionId $roleDefinitionId `
    -DirectoryScopeId "/" `
    -PrincipalId $userId `
    -ScheduleInfo @{
        StartDateTime = $startTime
        Expiration = @{
            Type = "AfterDuration"
            Duration = "P30D" # 30 days
        }
    } `
    -Action "AdminAssign" `
    -Justification "Project-based access for Q3 migration"

Understanding the Code

  • New-MgRoleManagementDirectoryRoleAssignmentScheduleRequest: This is the primary cmdlet for PIM. It creates a request to schedule a role assignment.
  • RoleDefinitionId: You must obtain the GUID for the specific role you are assigning. You can find these by running Get-MgRoleManagementDirectoryRoleDefinition.
  • ScheduleInfo: This defines the start time and the expiration. The Duration parameter uses ISO 8601 format (e.g., P30D for 30 days).
  • Action: We use AdminAssign because we are assigning the role to someone else, rather than the user requesting it themselves.

Not read yet

Best Practices for PIM Strategy

Implementing PIM is not just a technical task; it is an organizational process change. If you do not configure it correctly, you may inadvertently create security gaps or cause frustration for your IT staff.

1. The "Break-Glass" Account Rule

One of the most common mistakes is putting your "break-glass" accounts (emergency access accounts) under the control of PIM. If your PIM configuration becomes corrupted or if there is an issue with the Microsoft Entra service, you could lock yourself out of your own tenant. Always maintain at least two highly privileged, cloud-only accounts that have permanent, non-PIM-governed access, and store their credentials in a secure, physical location (like a safe).

2. Use Groups Instead of Users

Instead of assigning roles directly to individual user accounts, assign them to Microsoft Entra groups. You can then make those groups "eligible" for PIM roles. This allows you to manage membership via standard group management workflows. When a user joins the "IT Administrators" group, they automatically inherit the ability to activate the roles assigned to that group.

3. Review Regularly

PIM includes an "Access Review" feature. Use this to conduct quarterly or semi-annual audits of who has access to what. You can configure PIM to automatically email managers or resource owners, asking them to "Approve" or "Deny" continued access for their staff. If they do not respond, you can set PIM to automatically remove the access. This is an essential control for compliance frameworks like SOC2, HIPAA, or ISO 27001.

Warning: Approval Fatigue Do not require approval for every single role activation if your IT team is large. If an administrator has to wait for a manager to approve a "Helpdesk Admin" request at 2:00 AM, they will eventually find ways to bypass the system. Require approval for high-impact roles (like Global Admin) and allow auto-approval for lower-risk roles (like Helpdesk or Teams Admin), provided they pass MFA.


Not read yet

Common Pitfalls and How to Avoid Them

Pitfall 1: Over-Privileging Service Principals

PIM is excellent for human users, but many administrators forget about Service Principals (applications). If an application has the "Global Administrator" role, that access is essentially permanent and cannot be "activated" via PIM in the same way a human does.

  • Solution: Use Managed Identities whenever possible and strictly limit the scope of application permissions using App Registrations. Audit your Service Principals regularly to ensure they aren't carrying excessive roles.

Pitfall 2: Ignoring Audit Logs

PIM creates a wealth of data regarding who activated what role and when. Many organizations turn on PIM but never look at the logs until a breach occurs.

  • Solution: Integrate your Entra logs with a SIEM (like Microsoft Sentinel) or a Log Analytics workspace. Set up alerts for "Global Administrator" activations so the security team receives a notification whenever a high-level role is activated.

Pitfall 3: Inconsistent Policy Application

If you have 50 roles and you only apply strict PIM policies to 5 of them, you have left 45 backdoors open.

  • Solution: Develop a "Role Tiering" model. Tier 0 roles (Global Admin, Security Admin) should have the strictest policies (MFA, Approval required). Tier 1 roles (Exchange, SharePoint) should have moderate policies. Tier 2 roles (Read-only access) might require less friction.

Not read yet

Comparison: Permanent vs. PIM-Based Access

Feature Permanent Assignment PIM Eligible Assignment
Risk Exposure High (24/7 access) Low (Access is JIT)
Auditability Poor (Requires manual logs) Excellent (Built-in reports)
User Experience Seamless (Always on) Friction-based (Requires activation)
Lifecycle Manual removal Automatic expiration
Compliance Difficult to prove Simple (via Access Reviews)

Managing Privileged Groups

Microsoft Entra Privileged Identity Management also supports "Privileged Groups." This is a powerful feature that allows you to manage membership in highly sensitive groups (like "Domain Admins" or "Cloud Infrastructure Owners") using the same PIM workflow.

When a group is made "Privileged" in PIM, members of that group do not have the group's permissions by default. They must go through the same activation process as a role. This is particularly useful for on-premises groups that have been synchronized to the cloud via Microsoft Entra Connect.

Steps to Configure a Privileged Group:

  1. Go to Privileged Identity Management > Groups.
  2. Select Discover groups to find the groups you want to manage.
  3. Select the group and choose Manage > Settings.
  4. Configure the activation requirements (MFA, approval, etc.).
  5. Add members as "Eligible."

This approach allows you to secure sensitive administrative groups without having to change the underlying architecture of your on-premises Active Directory.


Not read yet

The Role of Access Reviews

Access reviews are the "cleanup crew" of your identity strategy. Even with PIM, users will eventually accumulate access they no longer need. An access review allows you to define a process where assigned roles are periodically validated by a designated reviewer.

Setting Up an Access Review:

  • Reviewer Selection: You can choose the user themselves, their manager, or a specific group of admins.
  • Duration: Decide how long the review period lasts (e.g., 14 days).
  • Auto-Apply: You can enable the "Auto-apply results to resource" setting. If a reviewer denies access, PIM will automatically strip the user of that role. This removes the manual burden from your IT team.

Tip: The "Self-Review" Trap Avoid letting users review their own access. While it is convenient, it defeats the purpose of an audit. Always designate a manager or a peer-reviewer to ensure there is a separation of duties.


Not read yet

Dealing with "Hidden" Administrative Access

One of the most difficult parts of managing a tenant is finding all the places where administrative rights are granted. You might have roles assigned in the Microsoft 365 Admin Center, the Azure portal, the Security & Compliance center, and individual workload centers like Exchange Online or SharePoint.

PIM provides a "Discovery" feature that scans your tenant for permanent roles that should be brought under PIM management. When you first enable PIM, run the discovery tool to identify all current "Global Administrators." You will likely find accounts that are no longer in use, or accounts that were created for a temporary project years ago. Create a plan to migrate these permanent assignments to PIM-eligible assignments over a 30-day period.


Advanced Monitoring with Microsoft Sentinel

While the PIM dashboard provides excellent visibility, large enterprises often need to correlate PIM events with other security signals. By streaming your PIM logs into Microsoft Sentinel, you can create custom workbooks and alerts that provide deeper insights.

Example: Custom Sentinel Query

You can use KQL (Kusto Query Language) to identify suspicious activation patterns, such as an administrator activating a role outside of business hours.

AuditLogs
| where OperationName == "Add member to role completed"
| where TargetResources[0].type == "Role"
| extend RoleName = tostring(TargetResources[0].displayName)
| extend Actor = tostring(InitiatedBy.user.userPrincipalName)
| project TimeGenerated, Actor, RoleName, Result
| order by TimeGenerated desc

This query shows you exactly who is activating roles. You can extend this by adding a filter for TimeGenerated to flag activations occurring between 10:00 PM and 6:00 AM, which might warrant an investigation.


Not read yet

Summary and Key Takeaways

Managing roles with Privileged Identity Management is a foundational requirement for any secure Microsoft 365 environment. It shifts the security posture from a "trust by default" model to a "verify every time" model. By following the practices outlined in this lesson, you can significantly reduce your risk of a major security incident.

Key Takeaways:

  1. Adopt Just-in-Time Access: Move away from permanent administrative assignments. Every role, especially high-impact ones, should be eligible rather than active.
  2. Enforce MFA for Everything: Never allow an administrative role to be activated without a strong MFA challenge. This is the single most effective way to stop credential-based attacks.
  3. Implement Approval Workflows: For critical roles like Global Administrator, require a second set of eyes (a peer or manager) to approve the activation request.
  4. Use Access Reviews: Regularly audit who has access to your environment. Automate the removal of access for users who no longer require it to maintain a clean security state.
  5. Protect Your Break-Glass Accounts: Ensure that your emergency access accounts remain outside of the PIM workflow to prevent a "lockout" scenario if the PIM service encounters an issue.
  6. Leverage Groups: Use Microsoft Entra groups for PIM assignments to simplify the management of large teams and ensure consistent policy application.
  7. Monitor and Alert: Integrate your PIM logs with a logging platform like Microsoft Sentinel. Treat role activations as security events that warrant monitoring, not just administrative tasks.

By implementing these strategies, you are not just checking a box for compliance; you are building a resilient identity infrastructure that can withstand the evolving threats of the cloud era. PIM requires an initial investment in time and process design, but the resulting security posture is far superior to any static, permanent access model.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.