Get eligible and active members of an azure ad group with powershell

Martin Gospodinov 6 Reputation points
2023-07-20T11:30:41.7266667+00:00

Hi all,

In our company we assign group membership through PIM. How can I get all members of a group, both eligible and active?

Tried using Get-AzureADMSPrivilegedRoleAssignment -ProviderId "aadRoles" -ResourceId "<groupID>"

but this returns more than 100 results, while the group has only one eligible and one active member.

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,810 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
23,252 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 113.8K Reputation points MVP
    2023-07-20T18:17:36.9633333+00:00

    You can use the Get-MgRoleManagementDirectoryRoleAssignmentSchedule cmdlet from the Graph SDK to cover active role assignments, and the Get-MgRoleManagementDirectoryRoleEligibilitySchedule one to cover eligible ones.

    Get-MgRoleManagementDirectoryRoleAssignmentSchedule -All
    Get-MgRoleManagementDirectoryRoleEligibilitySchedule -All | ? {$_.PrincipalId -eq "fe506ef0-235f-43cf-ae0c-e82f833c3e91"}
    

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.