cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IDonknowwhay
Frequent Visitor

PowerAutomate Loop through an AAD Security Group to find all Users

Hi

Is there a way in Power Automate / Power Flow where I can get all the users which belongs to a AAD security group (All_of_IT) and nested groups within the group?

e.g.

  • All_of_IT
    • User_1
    • User_2
    • User_3
    • IT_Operations
      • User_3
      • IT_Developers
        • User_2
        • User_7
        • User_8
      • IT_Engineers
        • User_5
        • User_6
      • IT_Team_Leads
        • User_1
        • User_3
        • User_6

The Flow will receive the Object_Id from a PowerApp App to identify "All_of_ IT" or any other Security Group

The result set should be:

  • User_1
  • User_2
  • User_3
  • User_5
  • User_6
  • User_7
  • User_8

(There is a commandlet in PowerShell called Get-ADGroupMember which will do what I need, but my objective is to find a solution that is a 100% cloud-based.)

 

You help will be much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @IDonknowwhay,

 

You could use the List group transitive members method of the Graph API in a Send an HTTP request action of the Groups connector. That method should also list all the members of the nested objects. 

 

With a filter array you can make sure it only outputs users.


Below is an example of that approach.

 

transitivemembers_method.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

3 REPLIES 3
Expiscornovus
Super User
Super User

Hi @IDonknowwhay,

 

You could use the List group transitive members method of the Graph API in a Send an HTTP request action of the Groups connector. That method should also list all the members of the nested objects. 

 

With a filter array you can make sure it only outputs users.


Below is an example of that approach.

 

transitivemembers_method.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


IDonknowwhay
Frequent Visitor

Hi @Expiscornovus 

 

Thank you for the detailed solution 😁

Expiscornovus
Super User
Super User

Hi @IDonknowwhay,


I had another look, that Filter Array is not even needed. You can even get the users with the setup below.

 

https://graph.microsoft.com/v1.0/groups/@{variables('Object_Id')}/transitiveMembers/microsoft.graph.user?$count=true

 

getnestedgroupmembers_filterarrayobsolete.PNG



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,846)