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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to get list of Azu...
Power Apps
Unanswered

How to get list of Azure AD groups where current users is member of?

(0) ShareShare
ReportReport
Posted on by 18

I would like to get list of AD groups of current user. How to do it?

I would like to use AD groups for authorization like if is member of admin group or not and provide admin feature in PowerApps

 

 

Categories:
I have the same question (0)
  • vecerpa Profile Picture
    786 on at

    Hi @kenny_i,

    As far as I know there is no connector to lokal AD.

     

    But there is connector to AzureAD that can be used for this (warning it is in Preview, so it can be changed).

    Here is detailed description of this connector - https://docs.microsoft.com/en-us/connectors/azuread/ we are looking for function AzureAD.CheckMemberGroups. This function check membership of currently logged user against specific group. GroupID can be obtained from AzureAD.

     

    UpdateContext() updates variable inside PowerApp that can be used in other parts of PA to enable/disable admin functions based on Azure AD group membership.

     

    So the whole formula should look like this:

     

    If(IsEmpty(
     AzureAD.CheckMemberGroups(User().Email,Table({Value:"This is where the group ID will go"}))
     ), 
     UpdateContext({ShowAdminLogin:false}),
     UpdateContext({ShowAdminLogin:true})
     )

    Hope this is helpful.

    P.

  • kenny_i Profile Picture
    18 on at

    Do you mean that example checks if user belongs to certain AD group or not by GroupID?

     

    Is it possible to get list of ad groups by current user? Let say "AdministorGroup", "FinanceGroup", "USGroup"?

  • vecerpa Profile Picture
    786 on at

    Hi @kenny_i,

     

    Yes.

     

    Yes it is possible:

     

    Set(valGroups;AzureAD.GetMemberGroups(User().Email;false));;
    Set(valDisplayName;Concat(valGroups;AzureAD.GetGroup(Value).displayName;","))

    First set is loading into variable "valGroups" all IDs of groups where current user is a member.

    Second set is loading into variable "valDisplayName" by IDs stored in first variable name of such groups separated by comma.

     

    P.

  • vecerpa Profile Picture
    786 on at

    Hi again @kenny_i,

     

    I got one small update. It is not possible to use Azure AD connector when you want to share app with standard users and nod administrators. This connector requires specific permission that have only tenant administrators.

     

    There is need to create custom connector that will dig information about groups via Graph API. When working like this you can grant almost any permission (when you are tenant administrator) you want per custom connector you create....

     

    Here is link to thread - https://powerusers.microsoft.com/t5/Connectors/Issue-with-Azure-AD-Connector/m-p/118771/highlight/false#M825

     

    P.

  • YavapaiR Profile Picture
    43 on at

    Hi @vecerpa , @kenny_i ;

     

    Thanks for this post, it was useful! 

    I did a few changes on the formula to get it working on my end:

    Set(varGroups, AzureAD.GetMemberGroupsV2(cmbEmployee.Selected.Id,false));

    Side note: cmbEmployee is a combobox I have linked to O365 to search users, the code for the cmbEmployee is:

    Filter(AddColumns(Office365Users.SearchUser({searchTerm:cmbEmployee.SearchText, top:10}) As Temp, "EmpName", IsError(Office365Users.ManagerV2(Temp.Id))),EmpName=false) - end of side note.

    Set(varDisplayName, Concat(varGroups.value, AzureAD.GetGroup(Value).displayName,","))

  • SteveCochrane Profile Picture
    219 on at

    This does not answer the question. The request was to find the groups based on the current user. The Group ID will be unknown as there could be many.

  • YavapaiR Profile Picture
    43 on at

    Can refer to this post:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Active-Directory-User-Operations/m-p/2090047#M522411 

     

    Best regards,

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard