Forum Discussion

Brahmaiah's avatar
Brahmaiah
Brass Contributor
Aug 21, 2020

How to list azure AD groups for a user using Power shell

Hi,

 

Could you please help me how to get list of azure AD groups for a user using power shell.

 

Thanks,

Brahma

  • HidMov's avatar
    HidMov
    Steel Contributor

    Hi Brahmaiah 

     

    I use the below:

     

    Get-AzureADUser -SearchString user@domain.com | Get-AzureADUserMembership | % {Get-AzureADObjectByObjectId -ObjectId $_.ObjectId | select DisplayName,ObjectType,MailEnabled,SecurityEnabled,ObjectId} | ft

     

    Where the user@domain.com is the UPN of who you want to search. This will return all groups aside from Dynamic groups.

     

     

    Source: https://www.michev.info/Blog/Post/1655/quickly-list-all-groups-a-user-is-member-of-or-owner-of-in-office-365

     

    • Brahmaiah's avatar
      Brahmaiah
      Brass Contributor

      thanks HidMov for your reply.

       

      I am getting below error, can you please suggest me how to run this command on my powershell ISE.

       

       

      I changed to az instead of azure in commands. But still few commands not working.

       

       

      Thanks,

      Brahma

      • Brahmaiah's avatar
        Brahmaiah
        Brass Contributor

        HidMov  It is working after instaling below module.

         

        Install-Module AzureAD -Repository PSGallery -Force -Scope CurrentUser

         

        thank you so much for your help. It is resolved my issue.

Resources