How assigne members in PIM in Powershell / MG Graph

Kevin Gauthier 0 Reputation points
2024-05-23T07:55:30.08+00:00

Hello, I have automated the creation of groups in my tenant.

I already used the Assignment Membership with PIM but actually, i did it directly from my browser.

I would like to automated this process too.

Could you please tell me how can i assign members with PIM from Powershell/ MSGraph.

Thanks

Microsoft Security Microsoft Entra Microsoft Entra ID
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sandeep G-MSFT 20,906 Reputation points Microsoft Employee Moderator
    2024-05-24T08:41:34.4466667+00:00

    @Kevin Gauthier

    Thank you for posting this in Microsoft Q&A.

    As I understand you want help in getting roles assigned to groups using PowerShell.

    You can follow below steps to do the same,

    To successfully complete this assignment using PowerShell, make sure you have the required prerequisites:

    1. Microsoft Graph PowerShell SDK is installed. Follow the Install the Microsoft Graph PowerShell SDK guide to install the SDK.
    2. To use the Microsoft Entra Privileged Identity Management, you must have one of the following licenses:
      • Microsoft Entra ID P2
      • Enterprise Mobility + Security (EMS) E5 license
    3. Microsoft Graph PowerShell using a Global Administrator role and the appropriate permissions. For this tutorial, the RoleManagement.ReadWrite.Directory delegated permission is required. To set the permissions in Microsoft Graph PowerShell, run; Connect-MgGraph -Scopes "RoleManagement.ReadWrite.Directory"

    Select Consent on behalf of your organization before accepting in the sign-in dialog box.

    Post this you can follow below article to make the group eligible for role assignment.

    https://learn.microsoft.com/en-us/powershell/microsoftgraph/tutorial-pim?view=graph-powershell-1.0#step-2-create-an-eligible-role-assignment-for-the-user-for-10-hours

    Follow the same article to extend, activate, deactivate and removing eligible assignments using PowerShell.

    Let me know if you have any further questions.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.