/EasyPIM

EasyPIM let you manage PIM Azure Resource, Entra Role and Groups settings and assignements with ease

Primary LanguagePowerShellMIT LicenseMIT

Introduction

EasyPIM is a PowerShell module created to help you manage Microsof Entra Privileged Identity Management (PIM).
Packed with more than 30 cmdlets, EasyPIM leverages the ARM and Graph APIs to let you configure PIM Azure Resources, Entra Roles and groups settings and assignments in a simple way .

PSGallery Version PSGallery Downloads

Key features

πŸ’₯ Support editing multiple roles at once
πŸ’₯ Copy settings from one role to another
πŸ’₯ Export role settings to csv
πŸ’₯ Import role settings from csv
πŸ’₯ Backup all roles
πŸ’₯ New in V1.6 get PIM activity reporting

With the export function you can now edit your PIM settings in Excel then import back your changes πŸ˜‰

Installation

This module is available on the PowerShell gallery: https://www.powershellgallery.com/packages/EasyPIM, install it with:

Install-Module -Name EasyPIM 

Updating from an older version:

Update-Module -Name EasyPIM 

Sample usage

Note: EasyPIM manage PIM Azure Resource settings at the subscription level by default : enter a tenant ID, a subscription ID, a role name then the options you want to set, for example require justification on activation.
If you want to manage the role at another level (Management Group, Resource Group or Resource) please use the scope parameter instead of the subscriptionID.

πŸ”· Get configuration of the Azure Resources roles reader and Webmaster

Get-PIMAzureResourcePolicy -TenantID $tenantID -SubscriptionId $subscriptionID -rolename "reader","webmaster"

πŸ”· Require justification, ticketing and MFA when activating the Entra Role testrole

Set-PIMEntraRolePolicy -tenantID $tenantID -rolename "testrole"  -ActivationRequirement "Justification","Ticketing","MultiFactorAuthentication"

πŸ”· Require approval and set approvers for Azure roles webmaster and contributor

Set-PIMAzureResourcePolicy -TenantID $tenantID -SubscriptionId $subscriptionID -rolename "webmaster","contributor" -Approvers  @(@{"Id"="00b34bb3-8a6b-45ce-a7bb-c7f7fb400507";"Name"="John";"Type"="user"}) -ApprovalRequired $true

πŸ”· Set maximum activation duration to 4h for the member role of a group

Set-PIMGroupPolicy -tenantID $tenantID -groupID "ba6af9bf-6b28-4799-976e-ff71aed3a1bd" -type member -ActivationDuration "PT4H"

πŸ”· Get a reporting of the PIM activities based on Entra ID Audit logs

$r=Show-PIMReport -tenantID $tenantID

πŸ”· List all eligible assignments for Azure roles

 Get-PIMAzureResourceEligibleAssignment -tenantID $tenantID -subscriptionID $subscriptionId

πŸ”· Create an active assignment for a principal and the Entra role testrole

New-PIMEntraRoleActiveAssignment -tenantID $tenantID -rolename "testrole" -principalID $groupID

More samples available in the documentation

Requirement

  • Az.Accounts module
  • Permission: The PIM API for Azure resource roles is developed on top of the Azure Resource Manager framework. You will need to give consent to Azure Resource Management but won’t need any Microsoft Graph API permission. You will also need to make sure the user or the service principal calling the API has at least the Owner or User Access Administrator role on the resource you are trying to administer.
  • an administrator must grant consent these permissions to the Microsoft Graph PowerShell application:
    "RoleManagementPolicy.ReadWrite.Directory", "RoleManagement.ReadWrite.Directory", "RoleManagementPolicy.ReadWrite.AzureADGroup", "PrivilegedEligibilitySchedule.ReadWrite.AzureADGroup", "PrivilegedAssignmentSchedule.ReadWrite.AzureADGroup", "PrivilegedAccess.ReadWrite.AzureADGroup"

Documentation

documentation