cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Dual Super User
Dual Super User

Re: Flow to return AD groups of logged in user

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

Highlighted
Frequent Visitor

Re: Flow to return AD groups of logged in user

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.

Highlighted
Dual Super User
Dual Super User

Re: Flow to return AD groups of logged in user

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

Highlighted
Frequent Visitor

Re: Flow to return AD groups of logged in user

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?

Highlighted
Dual Super User
Dual Super User

Re: Flow to return AD groups of logged in user

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

 

Highlighted
Frequent Visitor

Re: Flow to return AD groups of logged in user

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
secondImage

August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (3,519)