Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Get users and security roles for all environment

(2) ShareShare
ReportReport
Posted on by 602

Hi,

as part of our monitoring of the Power Platform and users permissions I'm trying to get a list of users with their associated security roles for all environments that have a Dataverse database.

 

According to this post, this is not possible, but the post is already quite old, so things might have changed.

 

In this post they explain that you need to add a "set" suffix to the table relationship name, but for me this does not work (see screenshot). I get an error "table not found".

 

leo85_0-1651756386726.png

 

Using the expand query with the "Users" table also does not work (there is no error, but no data is retrieved about the user roles).

leo85_1-1651757598446.png

 

Edit: When I use the current Dataverse connector (instead of the legacy one), it does work, but only for the current environment. This is unfortunately not sufficient, because we have 200+ environments and I can't replicate the flow this many times.

leo85_1-1651762606882.png

 

 

Does anybody know how to get the information without doing it by hand?

 

Regards

  • Suggested answer
    LR-12081549-0 Profile Picture
    2 on at
    Get users and security roles for all environment

    Here's what worked for me:

    I first followed the guide in this post: Retrieve List of Users and Roles in Environment, and then I applied the solution provided by v-bofeng-msft.

     

    List rows from selected environment: 

    items('Apply_to_each_-_environment')?['properties/linkedEnvironmentMetadata/instanceUrl']

    Apply to each: outputs('List_rows_from_selected_environment')?['body/value']

    Apply to each 2: items('Apply_to_each')?['systemuserroles_association']
     
  • Rómulo Profile Picture
    14 on at
    Re: Get users and security roles for all environment

    @leo85Hi, did you find the workaround?

    Thanks,

    RR

  • leo85 Profile Picture
    602 on at
    Re: Get users and security roles for all environment

    Hi @v-bofeng-msft ,

    thank you for the reply. Unfortunately, accessing the environment itself is not the problem, but getting the right data from the table. My flow is using the code you supplied.

     

    leo85_0-1652076624521.png

     

    Regards

    Leo

     

  • v-bofeng-msft Profile Picture
    on at
    Re: Get users and security roles for all environment

    Hi @leo85 ,

     

    Please try:

    items('Apply_to_each')?['properties/linkedEnvironmentMetadata/instanceUrl']

    vbofengmsft_0-1652065750682.png

     

    Best Regards,

    Bof

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492