Hi Team,

I’m trying to pull the users list from just a few
(500 Groups out of 10K )Azure AD groups. Is there a way to do in bulk

Regards,

Teja

10 Spice ups

What have you tried? Generically speaking, you’d just run something like Get-MgGroupMember in a foreach loop.

1 Spice up

Hi Mike,

Thank you for the reply. The below is giving me the complete list of the AD groups and users inside of it. I would like to export only few AD groups and I’m not getting any clue how to filter that

Connect-AzureAD

$groups = Get-AzureADGroup -All $true | select DisplayName,ObjectID
Foreach ($group in $groups) {
Get-AzureADGroupMember -ObjectID $group.ObjectID |
Export-CSV -Path “C:\Results$($group.DisplayName)_Members.csv”
}

Hello @teja1027

Use the -Top switch (instead of -All):

(-Top Specifies the maximum number of records to return)

You can use -Top (i.e. -Top 10 for 10 records (default is 100)).

you are possibly running into Graph and paging

Since everything is now moving to graph, they don’t want lots of bad queries slowing everyone down, so they are basically putting restrictor plates on.

you may want to look into Get-MgGroup note you may need Select-MgProfile -Name “beta” to get the data you are looking for. I found out about it the hard way.