web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How best to populate a...
Power Apps
Unanswered

How best to populate a dropdown or combobox with users from an Azure AD security group

(0) ShareShare
ReportReport
Posted on by 782

I need to populate a dropdown or combobox with the members of a Security Group in Azure AD/Office365. I recently did this using a Collection, but was told that I should avoid Collections as you take a bigger hit performance wise with a collection. So, how do I get the members of an AD Security Group into one of these boxes and to display the members in a format of Lastname, Firstname?

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    Hi @Greg27 

    In general, you can use the following formula in your app (best done in OnStart or OnVisible or some other trigger):

    Set(glbGroupMembers, 
     AddColumns(AzureAD.GetGroupMembers(<groupIDhere>).value, 
     "_lastFirst", surname & ", " & givenName
     )
    )

    Since this is a security group, you will need to use the AzureAD connector for it.

    An Office 365 group is different than an AD group when dealing with security groups.

    You will need to know the group ID in order to get the names.

     

    If you want to include multiple groups, then I would suggest the following:

    Set(glbGroupMembers, 
     Ungroup(
     Table({GroupName: "Group1", 
     Items:
     AddColumns(AzureAD.GetGroupMembers(<group1IDhere>).value, 
     "_lastFirst", surname & ", " & givenName
     )
     },
     {GroupName: "Group2", 
     Items:
     AddColumns(AzureAD.GetGroupMembers(<group2IDhere>).value, 
     "_lastFirst", surname & ", " & givenName
     )
     },
     {GroupName: "Group3", 
     Items:
     AddColumns(AzureAD.GetGroupMembers(<group3IDhere>).value, 
     "_lastFirst", surname & ", " & givenName
     )
     }
     ),
     "Items"
     )
    )
    
    )

    This will give you all the groups into one table with an identifying GroupName to distinguish them.

     

    If for some reason you really want to avoid the Azure connector, there is no real way to do that with the 365 connector as it is a different type of group.  If your group is defined in both places (linked), then you can "try" the 365 connector for groups, but if not, then the Azure connector is needed.

    If you absolutely have to avoid it (which I am not seeing a specific reason to do so), then you would need to go with a separate list with the users in it that is created by PowerAutomate or another PowerApp to sync the members of a group to the list...then you can use that list as the source in your formulas instead (much simpler formula than above).

     

    I hope this is helpful for you.

  • Greg27 Profile Picture
    782 on at

    @RandyHayes 

    Our 365 Connector does work with group. My understanding is that Azure AD and Office 365 mirror each other. When I used Collections in my 1st app, I created collections based on AD Security Groups using the Office365Groups connector.

    So, I setup my new app with your code in the OnStart property of my app and, just to test, the Items property of my DropDown, I set to Filter(glbGroupMembers, GroupName = "Group1") and I am getting no values. When I hover over the statement, it says "We didn't find any data". I tried to see if I could see any values by selecting the menu "View" and then "Variables". I see "glbGroupMembers", but is there a way I should be able to see what it contains like I can with Collections?

     

    Is there a limit to the number of rows or records you can load into a table? I checked my 3 AD Security Groups and one of them has 1,487 users. Will that keep this from working?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 326 Most Valuable Professional

#2
11manish Profile Picture

11manish 168

#3
sannavajjala87 Profile Picture

sannavajjala87 75 Super User 2026 Season 1

Last 30 days Overall leaderboard