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

Flow to return AD groups of logged in user

Hi there, 

 

My goal is to create a PowerApp which detects which Azure AD groups the logged in user is a member of.

However this is an app that needs to run for non-admin users (who don't have access to the Azure AD connector).

So the idea is to create a flow which uses my admin login to run the Azure AD connector to return the AD groups and then write that back to PowerApps.

That way they don't need admin access for the information to be returned.

 

Based on their AD group membership they will have access to specific files.

 

At the minute I have a button in PowerApps that runs the flow and displays in a label.

 

This is the flow (ADtest)

flow.PNG

I assumed it would use the logged in user id in the Getgroupofauser_UserIdorPrincipleName but I get an error in the PowerApps running the button logic ADtest.Run(lbl_ADGroups)

 

Edit: Also tried this to retrieve the user id from the PowerApp form and then use this ID to find the AD groups...no dice.

flow2.PNG

 

Error is ADtest.Run failed: The method 'Run' has an invalid value for parameter 'Getgroupofauser_UserIdorPrincipleName'

 

Can anyone assist?

 

 

flow.PNG

6 REPLIES 6
RezaDorrani
Dual Super User II
Dual Super User II

Hi @Mrobbo 

 

Share screenshot of the flow run 

Also, highlight the value being passed in the screenshot

 

Note: when PowerApps calls Flow it will call Flow in the context of the logged in user

 

Regards,

Reza Dorrani

 

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

Hi @RezaDorrani 

 

From the history it looks like the flow hasn't run, maybe its the PowerApp code that is wrong.

 

I'm not sure what you mean by the value being passed? (As I said I'm a flow novice)

 

Note: But I was thinking the flow could use a connector even though the logged in user doesn't have the permission.

RezaDorrani
Dual Super User II
Dual Super User II

Hi @Mr0bb0 @Mrobbo 

 

If the Flow has not run that means PowerApps has not called the Flow

 

when you call the Flow from PowerApps, check the app checker to see if there are any errors highlighted

Hi @RezaDorrani 

 

The flow won't run because of the error:

 

Error is ADtest.Run failed: The method 'Run' has an invalid value for parameter 'Getgroupofauser_UserIdorPrincipleName'

 

It seems like I need to add a step before running the action Get user or Get Groups of a user as it doesn't initalise the flow.

 

I'm thinking the issue is with the Flow not the PowerApp but I could be wrong?

RezaDorrani
Dual Super User II
Dual Super User II

Hi @Mrobbo @Mr0bb0 

 

when you are calling Flow you need to send the user id value as a string

 

ADtest.Run(lbl_ADGroups)

Looks like you are storing the value in lbl_ADGroups (which is a label) - but you are passing entire label context

 

change to

ADtest.Run(lbl_ADGroups.Text) - you need to send the text to the Flow

 

Check what value you have in lbl_ADGroups_Text

 

Regards,

Reza Dorrani

 

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

 

Hi @RezaDorrani ,

 

I've tried changing the button logic to ADtest.Run(lbl_ADGroups.Text),

 

But I get the same error in PowerApps:

 

Error is ADtest.Run failed: The method 'Run' has an invalid value for parameter 'Getgroupofauser_UserIdorPrincipleName'

 

 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (39,734)