cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SeanHenderson
Level: Powered On

Disabling Button Based on Azure AD Group Membership Using Azure AD Connector

Hi, 

I am trying to disable a button if the user of the app is not in a certain Azure AD group. I am using the Azure AD Connector for PowerApps and Flow.

I set the DisplayMode property on the button to:

If(!IsBlank(LookUp(AzureAD.GetGroupMembers("8dfe30dc-1135-4f55-8b11-9b943fabf97f").value, User().Email in mail)),DisplayMode.Edit, DisplayMode.Disabled)

This was based on a previous suggestion someone made. I thought it was working, but if I put in different values for the object ID, the button stays enabled. Even if I'm not a member of the group that the object ID is reference. Perhaps I am using the IsBlank or LookUp functions wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
RezaDorrani
Level 10

Re: Disabling Button Based on Azure AD Group Membership Using Azure AD Connector

Hi @SeanHenderson 

 

Use If(!IsBlank(LookUp(AzureAD.GetGroupMembers("ea7176d8-f207-4802-b911-85acad8f4d48").value, User().Email in mail).displayName),DisplayMode.Edit, DisplayMode.Disabled)

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

2 REPLIES 2
RezaDorrani
Level 10

Re: Disabling Button Based on Azure AD Group Membership Using Azure AD Connector

Hi @SeanHenderson 

 

Use If(!IsBlank(LookUp(AzureAD.GetGroupMembers("ea7176d8-f207-4802-b911-85acad8f4d48").value, User().Email in mail).displayName),DisplayMode.Edit, DisplayMode.Disabled)

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

SeanHenderson
Level: Powered On

Re: Disabling Button Based on Azure AD Group Membership Using Azure AD Connector

@RezaDorrani 

Yup that totally worked, thank you!

I would be interested to know where my mistake was.

Also, while I was trying to figure it out I think I found a way to make it work using Concat:

If(User().Email in Concat(AzureAD.GetGroupMembers("8dfe30dc-1135-4f55-8b11-9b943fabf97f").value, mail), DisplayMode.Edit, DisplayMode.Disabled)

That appears, to work unless you see some reason why it might break under certain circumstances, in which case I always have your solution Smiley Very Happy

Thank you!

 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 62 members 4,902 guests
Please welcome our newest community members: