Our Story

Who we are and how we solve complex IT challenges.

Our Certifications

Microsoft certifications and partnerships validating our technical expertise.

Leadership

Meet the Experienced Leadership Team Driving WME’s Success

Advisory Updates

Expert guidance on Microsoft, security, and compliance developments.

Case Studies

Real-world outcomes from complex Microsoft-focused IT engagements.

Financial Industry

Secure technology solutions for regulated banks and financial institutions.

Healthcare

Secure Microsoft solutions for compliant, connected, and modern healthcare organizations.

Manufacturing

Cloud and security solutions supporting modern manufacturing operations.

Non-Profit

Cost-efficient Microsoft solutions for mission-driven organizations.

Public Sector

Microsoft-based IT services for secure public sector modernization.

High Tech

Scalable cloud, security, and staffing for fast-growing technology companies.

SMBs

Scalable cloud, security, and staffing for fast-growing technology companies.

Cloud Migration Services

Transition your workloads to the cloud securely for greater scalability and performance.

Data Migration Services

Securely transfer your business data with minimal downtime and maximum integrity.

Application Migration Services

Move your applications seamlessly to modern platforms with minimal business disruption.

Identity & Security Migration Services

Strengthen identity management and security while transitioning to modern Microsoft solutions.

IT Staffing

Connect with skilled IT professionals to strengthen your team and accelerate project delivery.

Accounting & Finance

Connect with experienced accounting and finance professionals to support your business goals.

Licensing Support

Discover the benefits of both CSP and On-premises licensing options and find the best fit for your unique business needs. From cost savings to flexibility, we’ve got you covered.

Power Platform

Unlock the full potential of the Microsoft Power Platform Suite to streamline operations, automate repetitive tasks, and gain real-time insights that drive business growth.

Sharepoint Solutions

Supercharge your business productivity and enhance visibility through our proven SharePoint expertise.

Security Solutions

Protect your business with proactive cybersecurity, compliance, and risk management solutions.

Endpoint Management

Secure, manage, and monitor every device with modern endpoint management solutions.

Change Entra ID PIM Activation Duration for All Entra ID Roles

May 2, 2025
Change Entra ID PIM Activation Duration for All Entra ID Roles

By default, the PIM activation duration on Entra ID roles is set to 8 hours. There isn’t a global setting to control this – it’s set individually on all 119 Entra ID roles (119 as of this writing). If you need to change this setting on all roles, that would take a good amount of time to do manually via the Entra ID portal.

One reason to do this is that, at least in the US, the typical workday is 9 hours long (8 AM to 5 PM), so admins need to reactivate their PIM roles at 4 PM. This could lead to PIM roles being active way into the evening after the admin has stopped working for the day.

This blog post will detail a script that will loop through each role and set the duration. In my environment, it took this script about five minutes to complete. You will need the Microsoft Graph PowerShell module called Microsoft.Graph.Identity.Signins to run this script, and the app registration in Entra ID for the Graph PowerShell module will need these permissions (either delegated or application – delegated recommended).

  • RoleManagementPolicy.Read.Directory
  • RoleManagementPolicy.ReadWrite.Directory
  • RoleManagement.ReadWrite.Directory
  • RoleManagement.Read.Directory
  • RoleManagement.Read.All

If the app registration doesn’t have these permissions, you will be prompted the first time you connect with the required scopes.

PowerShell Script to Modify Entra ID PIM Activation Duration for Roles

If you do not have the PowerShell module installed, you can install it with this command:

install-module Microsoft.Graph.Identity.Signins

Here is the script:

# Connect to Microsoft Graph with required roles

connect-mggraph -scopes "RoleManagementPolicy.Read.Directory,RoleManagementPolicy.ReadWrite.Directory,RoleManagement.ReadWrite.Directory,RoleManagement.Read.Directory,RoleManagement.Read.All"

 

# set parameters for rule

$params = @{

"@odata.type" = "#microsoft.graph.unifiedRoleManagementPolicyExpirationRule"

id = "Expiration_EndUser_Assignment"

isExpirationRequired = $true

maximumDuration = "PT9H" # SET THIS VALUE LEAVING OTHERS AS-IS. Format is PT__H__M.

target = @{

"@odata.type" = "microsoft.graph.unifiedRoleManagementPolicyRuleTarget"

caller = "EndUser"

operations = @(

"All"

)

level = "Assignment"

inheritableSettings = @(

)

enforcedSettings = @(

)

}

}

 

# get all PIM policies

$policies = Get-MgPolicyRoleManagementPolicy -Filter "scopeId eq '/' and scopeType eq 'DirectoryRole'"

 

# set up progress bar

$count = 0

$total = $policies.count

 

# loop through policies setting the expiration

$policies | ForEach-Object {

 

# set counts for progress bar

$count = $count + 1

$percent = $count/$total

$percent_readable = $percent.tostring("P")

$percent_bar = $percent * 100

# display progress bar

write-progress "processing $count of $total - $percent_readable complete." -PercentComplete $percent_bar

 

# update PIM rules

Update-MgPolicyRoleManagementPolicyRule -UnifiedRoleManagementPolicyId $_.Id -UnifiedRoleManagementPolicyRuleId "Expiration_EndUser_Assignment" -BodyParameter $params | out-null

}

Details on Modifying Entra ID PIM Activation Duration Script

The only item in the script that needs to be changed is the maximum duration value on line 9 within the params code block. Change that value to your value, keeping the same format.

Here are some examples to help you with formatting:

  • 12-hour duration: PT12H
  • 2-hour 30 minutes duration: PT2H30M
  • 3-hour 5 minutes duration: PT3H5M

The script will execute with a progress bar to help you know that the script is still in progress.

Disclaimer

All content provided on this blog is for information purposes only. Windows Management Experts, Inc. makes no representation as to the accuracy or completeness of any information on this site. Windows Management Experts, Inc. will not be liable for any errors or omissions in this information nor for the availability of this information. It is highly recommended that you consult one of our technical consultants, should you need any further assistance.

Windows Management Experts

Now a Microsoft Solutions Partner for: 

✓ Data & AI 

✓ Digital and App Innovation 

✓ Infrastructure 

✓ Security 

The Solutions Partner badge highlights WME’s excellence and commitment. Microsoft’s thorough evaluation ensures we’re skilled, deliver successful projects, and prioritize security over everything. This positions WME in a global tech community, ready to innovate on the cloud for your evolving business needs. 

Contact us: sales@winmgmtexperts.com

Share:

Facebook
Twitter
LinkedIn

Get Microsoft Updates Before They Cost You Downtime

Retirement dates, licensing changes, and security updates from a Microsoft-exclusive team, sent when they matter, not on a filler schedule.

More Posts

Copilot Cowork: Credit-Based Billing

Until now, Copilot Cowork has been included with M365 Copilot Premium licenses. Now that Cowork has moved out of public preview, Cowork is introducing a ...
Read Full Article
SharePoint OTP Retirement Is Coming in July 2026

SharePoint OTP Retirement Is Coming in July 2026 — What IT Admins Need to Do Before Access Breaks

Starting July 2026, external users who access OneDrive and SharePoint files through legacy SPO OTP links will start receiving access denied — silently, with no ...
Read Full Article
Power Virtual Agents Is Gone. Here's What Replaced It and Why It Matters.

Power Virtual Agents Is Gone. Here’s What Replaced It and Why It Matters.

If someone on your team still calls it “Power Virtual Agents,” they’re working from an outdated map. Microsoft retired the product on November 15, 2023 ...
Read Full Article

Get Microsoft Updates Before They Cost You Downtime

Retirement dates, licensing changes, and security updates from a Microsoft-exclusive team, sent when they matter, not on a filler schedule.
Subscription Form email