Forum Discussion
Deleted
Oct 04, 2022Identify all Azure AD group owners and assign P2
Hi, I want to assign access reviews to all Azure AD groups, and assign group owners as reviewers. Access reviewer need P2 license, but majority of users in tenant have only P1. So, I need to assi...
VasilMichev
Oct 04, 2022MVP
I cannot think of any other way of doing this, apart from enumerating all the groups. Should be fairly straightforward for any group type recognized by Exchange:
Get-Group -ResultSize unlimited | ? {$_.RecipientTypeDetails -ne "RoleGroup"} | select Name,ManagedBy
For Azure AD Security groups, you have to run separate cmdlets. But a direct Graph query will also work:
GET https://graph.microsoft.com/beta/groups?$top=1000&$expand=owners($select=userPrincipalName)&$select=displayName,owners
Get-Group -ResultSize unlimited | ? {$_.RecipientTypeDetails -ne "RoleGroup"} | select Name,ManagedBy
For Azure AD Security groups, you have to run separate cmdlets. But a direct Graph query will also work:
GET https://graph.microsoft.com/beta/groups?$top=1000&$expand=owners($select=userPrincipalName)&$select=displayName,owners