Find Azure AD User Group Membership Using PowerShell

In this post, we will learn how to use the Azure AD PowerShell module to find which groups a user is a member of using PowerShell.

Our previous article concluded that the best PowerShell module to use in the AzureAD out of the three available options.

Install and Connect

If you have not installed the AzureAD PowerShell module, go ahead and install it using the following command. Just remember that the module only works on a Windows machine.

install-module azuread

After installing the module, import it and check the version using the following commands, the final command will connect you to Azure AD and ask you to authenticate.

import-module azuread
get-module azuread
connect-azuread

Check Group Membership

To check a user group membership using PowerShell, I will run the following command with UPN details.

Get-AzureADUserMembership  -ObjectId UPN@userdomain.local | select displayname, description

The result will loook like the below output.

DisplayName             Description
-----------             -----------

Marketing            All marketing personnel
All Employees        Company wide (all users) 

Posted

in

,

by