Welcome to EasyPIM Discussions! #67
Replies: 8 comments 10 replies
-
|
Great project! I also wrote few automation scripts for PIM management on my own. Here are the things you could consider to add:
|
Beta Was this translation helpful? Give feedback.
-
|
@Azure365Addict please check #75 and tell me if it's what you asked |
Beta Was this translation helpful? Give feedback.
-
|
Hi, great job. To be more precise: |
Beta Was this translation helpful? Give feedback.
-
|
Reading through the project today, in the (https://github.com/kayasax/EasyPIM/blob/main/EasyPIM/Documentation/Invoke-EasyPIMOrchestrator.md) document I see you call out Delta Mode under the local configuration file yet in the example code it has -mode "initial" included. See below. I believe, if I'm reading this correctly, there should be no <-Mode "initial"> in that line so it is in default delta mode. From Local Configuration File |
Beta Was this translation helpful? Give feedback.
-
|
Hi, Am I supposed to be able to configure additional recipients on an Entra role ? I'm using successfuly this command... but the settings are never configured ; (Success, policy updated) Set-PIMEntraRolePolicy -tenantID $tenantID -rolename "Security Administrator" In Entra, the additionnal recipients values remain empty. |
Beta Was this translation helpful? Give feedback.
-
|
Here is my verbose output. I notice at the end that the PATCH URLs seem
wrong compare to yours. Thanks
VERBOSE: Function Set-PIMEntraRolePolicy is starting with parameters:
tenantID =>--REDACTED--, rolename =>Security Operator,
Notification_EligibleAssignment_Alert =>System.Collections.Hashtable,
Notification_ActiveAssignment_Alert =>System.Collections.Hashtable,
Notification_Activation_Alert =>System.Collections.Hashtable, Verbose =>True
VERBOSE: uri =
https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=displayname
eq 'Security Operator'
VERBOSE: GET
https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=displayname
eq 'Security Operator' with 0-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE: roleID = 5f2222b1-57c3-48ba-8ad5-d4759f1fde6f
VERBOSE: endpoint =
policies/roleManagementPolicyAssignments?$filter=scopeType eq
'DirectoryRole' and roleDefinitionId eq
'5f2222b1-57c3-48ba-8ad5-d4759f1fde6f' and scopeId eq '/'
VERBOSE: uri =
https://graph.microsoft.com/v1.0/policies/roleManagementPolicyAssignments?$filter=scopeType
eq 'DirectoryRole' and roleDefinitionId eq
'5f2222b1-57c3-48ba-8ad5-d4759f1fde6f' and scopeId eq '/'
VERBOSE: GET
https://graph.microsoft.com/v1.0/policies/roleManagementPolicyAssignments?$filter=scopeType
eq 'DirectoryRole' and roleDefinitionId eq
'5f2222b1-57c3-48ba-8ad5-d4759f1fde6f' and scopeId eq '/' with 0-byte
payload
VERBOSE: received -byte response of content type application/json
VERBOSE: policyID =
VERBOSE: uri =
https://graph.microsoft.com/v1.0/policies/roleManagementPolicies//rules
VERBOSE: GET
https://graph.microsoft.com/v1.0/policies/roleManagementPolicies//rules
with 0-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE:
Set-Notification_EligibleAssignment_Alert(System.Collections.Hashtable)
VERBOSE: end function notif elligible alert
VERBOSE: Performing the operation "Udpdating policy" on target "Security
Operator".
VERBOSE:
> PATCH body:
{
"rules": [
{
***@***.***":
"#microsoft.graph.unifiedRoleManagementPolicyNotificationRule",
"id": "Notification_Admin_Admin_Eligibility",
"notificationType": "Email",
"recipientType": "Admin",
"isDefaultRecipientsEnabled": true,
"notificationLevel": "All",
"notificationRecipients": [
***@***.******@***.***"
],
"target": {
"caller": "Admin",
"operations": [
"all"
],
"level": "Eligibility",
"inheritableSettings": [],
"enforcedSettings": []
}
}
,
{
***@***.***":
"#microsoft.graph.unifiedRoleManagementPolicyNotificationRule",
"id": "Notification_Admin_Admin_Assignment",
"notificationType": "Email",
"recipientType": "Admin",
"isDefaultRecipientsEnabled": true,
"notificationLevel": "All",
"notificationRecipients": [
***@***.******@***.***"
],
"target": {
"caller": "Admin",
"operations": [
"all"
],
"level": "Assignment",
"inheritableSettings": [],
"enforcedSettings": []
}
}
,{
***@***.***":
"#microsoft.graph.unifiedRoleManagementPolicyNotificationRule",
"id": "Notification_Admin_EndUser_Assignment",
"notificationType": "Email",
"recipientType": "Admin",
"isDefaultRecipientsEnabled": true,
"notificationLevel": "All",
"notificationRecipients": ***@***.***"],
"target": {
"caller": "EndUser",
"operations": [
"all"
],
"level": "Assignment",
"inheritableSettings": [],
"enforcedSettings": []
}
}]
}
VERBOSE: Patch endpoint : policies/roleManagementPolicies/
VERBOSE: uri =
https://graph.microsoft.com/v1.0/policies/roleManagementPolicies/
VERBOSE: PATCH
https://graph.microsoft.com/v1.0/policies/roleManagementPolicies/ with
2153-byte payload
VERBOSE: received -byte response of content type application/json
Success, policy updated
…On Mon, Jul 14, 2025 at 4:07 PM Loïc MICHEL - MSFT ***@***.***> wrote:
please add -verbose at the end of the command to see if you get more info.
Here is what I have on my side:
SC:\Windows\System32> Set-PIMEntraRolePolicy -tenantID $env:tenantID -rolename "testrole" -Notification_EligibleAssignment_Alert @{"isDefaultRecipientEnabled"="true"; "notificationLevel"="All"; "Recipients"=@***@***.******@***.***")} -Notification_ActiveAssignment_Alert @{"isDefaultRecipientEnabled"="true"; "notificationLevel"="All"; "Recipients"=@***@***.******@***.***")} -Notification_Activation_Alert @{"isDefaultRecipientEnabled"="true"; "notificationLevel"="All"; "Recipients"=@***@***.***")} -verbose
VERBOSE: Function Set-PIMEntraRolePolicy is starting with parameters: tenantID =>***
rolename =>testrole, Notification_EligibleAssignment_Alert =>System.Collections.Hashtable, Notification_ActiveAssignment_Alert =>System.Collections.Hashtable, Notification_Activation_Alert =>System.Collections.Hashtable, Verbose =>True
VERBOSE: uri = https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=displayname eq 'testrole'
VERBOSE: Fetching data from: https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=displayname eq 'testrole'
VERBOSE: GET https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=displayname eq 'testrole' with 0-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE: roleID = c2314e04-b23a-4dd5-915f-b0ab7487c9d9
VERBOSE: endpoint = policies/roleManagementPolicyAssignments?$filter=scopeType eq 'DirectoryRole' and roleDefinitionId eq 'c2314e04-b23a-4dd5-915f-b0ab7487c9d9' and scopeId eq '/'
VERBOSE: uri = https://graph.microsoft.com/v1.0/policies/roleManagementPolicyAssignments?$filter=scopeType eq 'DirectoryRole' and roleDefinitionId eq 'c2314e04-b23a-4dd5-915f-b0ab7487c9d9' and scopeId eq '/'
VERBOSE: Fetching data from: https://graph.microsoft.com/v1.0/policies/roleManagementPolicyAssignments?$filter=scopeType eq 'DirectoryRole' and roleDefinitionId eq 'c2314e04-b23a-4dd5-915f-b0ab7487c9d9' and scopeId eq '/'
VERBOSE: GET https://graph.microsoft.com/v1.0/policies/roleManagementPolicyAssignments?$filter=scopeType eq 'DirectoryRole' and roleDefinitionId eq 'c2314e04-b23a-4dd5-915f-b0ab7487c9d9' and scopeId eq '/' with 0-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE: policyID = DirectoryRole_9b08d26c-2c4e-45c8-9313-b700c2ee6e3d_0b6de493-d03a-4fe0-8c85-bfaf9e9da00b
VERBOSE: uri = https://graph.microsoft.com/v1.0/policies/roleManagementPolicies/DirectoryRole_9b08d26c-2c4e-45c8-9313-b700c2ee6e3d_0b6de493-d03a-4fe0-8c85-bfaf9e9da00b/rules
VERBOSE: Fetching data from: https://graph.microsoft.com/v1.0/policies/roleManagementPolicies/DirectoryRole_9b08d26c-2c4e-45c8-9313-b700c2ee6e3d_0b6de493-d03a-4fe0-8c85-bfaf9e9da00b/rules
VERBOSE: GET https://graph.microsoft.com/v1.0/policies/roleManagementPolicies/DirectoryRole_9b08d26c-2c4e-45c8-9313-b700c2ee6e3d_0b6de493-d03a-4fe0-8c85-bfaf9e9da00b/rules with 0-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE: Set-Notification_EligibleAssignment_Alert(System.Collections.Hashtable)
VERBOSE: end function notif elligible alert
VERBOSE: Performing the operation "Udpdating policy" on target "testrole".
VERBOSE:
>> PATCH body:
{
"rules": [
{
***@***.***": "#microsoft.graph.unifiedRoleManagementPolicyNotificationRule",
"id": "Notification_Admin_Admin_Eligibility",
"notificationType": "Email",
"recipientType": "Admin",
"isDefaultRecipientsEnabled": true,
"notificationLevel": "All",
"notificationRecipients": [
***@***.******@***.***"
],
"target": {
"caller": "Admin",
"operations": [
"all"
],
"level": "Eligibility",
"inheritableSettings": [],
"enforcedSettings": []
}
}
,
{
***@***.***": "#microsoft.graph.unifiedRoleManagementPolicyNotificationRule",
"id": "Notification_Admin_Admin_Assignment",
"notificationType": "Email",
"recipientType": "Admin",
"isDefaultRecipientsEnabled": true,
"notificationLevel": "All",
"notificationRecipients": [
***@***.******@***.***"
],
"target": {
"caller": "Admin",
"operations": [
"all"
],
"level": "Assignment",
"inheritableSettings": [],
"enforcedSettings": []
}
}
,{
***@***.***": "#microsoft.graph.unifiedRoleManagementPolicyNotificationRule",
"id": "Notification_Admin_EndUser_Assignment",
"notificationType": "Email",
"recipientType": "Admin",
"isDefaultRecipientsEnabled": true,
"notificationLevel": "All",
"notificationRecipients": ***@***.***"],
"target": {
"caller": "EndUser",
"operations": [
"all"
],
"level": "Assignment",
"inheritableSettings": [],
"enforcedSettings": []
}
}]
}
VERBOSE: Patch endpoint : policies/roleManagementPolicies/DirectoryRole_9b08d26c-2c4e-45c8-9313-b700c2ee6e3d_0b6de493-d03a-4fe0-8c85-bfaf9e9da00b
VERBOSE: uri = https://graph.microsoft.com/v1.0/policies/roleManagementPolicies/DirectoryRole_9b08d26c-2c4e-45c8-9313-b700c2ee6e3d_0b6de493-d03a-4fe0-8c85-bfaf9e9da00b
VERBOSE: PATCH https://graph.microsoft.com/v1.0/policies/roleManagementPolicies/DirectoryRole_9b08d26c-2c4e-45c8-9313-b700c2ee6e3d_0b6de493-d03a-4fe0-8c85-bfaf9e9da00b with 2153-byte payload
VERBOSE: received -byte response of content type application/json
Success, policy updated
—
Reply to this email directly, view it on GitHub
<#67 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BJI7LDVWOVEHFLXQJUZY2633IQEZVAVCNFSM6AAAAABPKEMJESVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGNZVGY3DGMQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
I'm using an account with Global Administrator privilege
…On Tue, Jul 15, 2025 at 2:59 AM Loïc MICHEL - MSFT ***@***.***> wrote:
that is failing at this step where no policyID is received....
https://graph.microsoft.com/v1.0/policies/roleManagementPolicyAssignments?$filter=scopeType
eq 'DirectoryRole' and roleDefinitionId eq
'5f2222b1-57c3-48ba-8ad5-d4759f1fde6f' and scopeId eq '/' with 0-byte
payload
VERBOSE: received -byte response of content type application/json
VERBOSE: policyID =
VERBOSE: uri =
I'm wondering if this could be due to missing permision (
https://learn.microsoft.com/en-us/graph/api/policyroot-list-rolemanagementpolicyassignments?view=graph-rest-1.0&tabs=http#for-pim-for-microsoft-entra-roles
) ; you need for write operations: Privileged Role Administrator
can you double check ?
—
Reply to this email directly, view it on GitHub
<#67 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BJI7LDV7D4VM2CIZM445SFL3ISRDJAVCNFSM6AAAAABPKEMJESVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGNZWGEYTKNA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Same result :(
…On Tue, Jul 15, 2025 at 8:24 AM Loïc MICHEL - MSFT ***@***.***> wrote:
hum...
Can you try to assign this role to a dummy user first in PIM then retry?
—
Reply to this email directly, view it on GitHub
<#67 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BJI7LDV6FJKC3SEN3KD4PDL3ITXHBAVCNFSM6AAAAABPKEMJESVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGNZWGQZTAMQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
👋 Welcome!
Hey, I'm Loïc, currently working at Microsoft as a support engineer in the Azure identity team.
I noticed this is not easy to find where to start when you want to automate PIM management. After struggling with the API I thought I can share a script to demonstrate the API usage.
This script was transformed to a module and hosted on the PowerShell gallery for your convenience.
Feel free to suggest any improvement that could be added, and consider staring this project if you find it useful!
Beta Was this translation helpful? Give feedback.
All reactions