Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AnttiKoskinen
Regular Visitor

Is there a way to show user his/her active RLS on a Power BI report when using PBI Service datasets?

I have not found a solution to do this and I'm wondering whether it is possible without creating a separate table elsewhere which includes all row level security details per user. Is there a way to access the security details I've added in PBI Service?

 

How have you solved this?

1 ACCEPTED SOLUTION

Hi, @AnttiKoskinen 

Thanks for your quick response! Soory for that i may misunderstand your need.

If you want to see the current user's attributes on the report page, you can use the USERNAME() function to place it in the card image for display.

 

If you want to get the RLS name and roles you configured in the current dataset. As searched, There is no Power BI REST API endpoint for this unfortunately.

To expand on that, you can connect to the XMLA endpoint using SSMS and run some queries by MDX query. There are pros and cons. In case you want more info, here is some doco with examples:

Dynamic Management Views (DMVs) in Analysis Services | Microsoft Learn

 

Using the DMVs you can get roles, members, and the role filters per table, however only one view can be queried at a time with no joins allowed. I ended up building up data from the following DMVs:

$SYSTEM.TMSCHEMA_ROLES
$SYSTEM.TMSCHEMA_ROLE_MEMBERSHIPS
$SYSTEM.TMSCHEMA_TABLES
$SYSTEM.TMSCHEMA_TABLE_PERMISSIONS

vyueyunzhmsft_1-1688113421412.png

 

 

For how to connect to the workspace you can refer to :
Dataset connectivity and management with the XMLA endpoint in Power BI - Power BI | Microsoft Learn

 

And for more information , you can refer to this:
Solved: REST API to get role names (RLS) from power bi se... - Microsoft Fabric Community

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

 

 

View solution in original post

3 REPLIES 3
v-yueyunzh-msft
Community Support
Community Support

Hi, @AnttiKoskinen 

According to your description, do you mean you want to  show user his/her active RLS on a Power BI report ?

You can show the user his/her active RLS on a Power BI report when using PBI Service datasets. You can use the "View As Roles" feature in PBI Service or "View as" In Desktop to see the data as a specific user and check if the RLS is working as expected.

For this , you can refer to :
Row-level security (RLS) with Power BI - Power BI | Microsoft Learn

How To Test RLS in Power BI Service - AzureOps

 

You can also access the security details you've added in PBI Service. You can add members (user or security group) to the Role you created in Power BI Desktop in PBI Service.

Row-level security (RLS) with Power BI - Power BI | Microsoft Learn

 

If you want to configure the dynamic RLS , you actually need to add a table to manage the right. For this , you can refer to :
Dynamic Row Level Security with Power BI Made Simple - RADACAD

Power BI Row Level Security and Dynamic RLS | by David Ding | Analytics Vidhya | Medium

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Thanks for reply and all this is good and already in use.

 

My need is to show user what his/her RLS attribute values are (those that I've inputed into the dataset). Is there any way to access the information so that it could be used in reporting?

Hi, @AnttiKoskinen 

Thanks for your quick response! Soory for that i may misunderstand your need.

If you want to see the current user's attributes on the report page, you can use the USERNAME() function to place it in the card image for display.

 

If you want to get the RLS name and roles you configured in the current dataset. As searched, There is no Power BI REST API endpoint for this unfortunately.

To expand on that, you can connect to the XMLA endpoint using SSMS and run some queries by MDX query. There are pros and cons. In case you want more info, here is some doco with examples:

Dynamic Management Views (DMVs) in Analysis Services | Microsoft Learn

 

Using the DMVs you can get roles, members, and the role filters per table, however only one view can be queried at a time with no joins allowed. I ended up building up data from the following DMVs:

$SYSTEM.TMSCHEMA_ROLES
$SYSTEM.TMSCHEMA_ROLE_MEMBERSHIPS
$SYSTEM.TMSCHEMA_TABLES
$SYSTEM.TMSCHEMA_TABLE_PERMISSIONS

vyueyunzhmsft_1-1688113421412.png

 

 

For how to connect to the workspace you can refer to :
Dataset connectivity and management with the XMLA endpoint in Power BI - Power BI | Microsoft Learn

 

And for more information , you can refer to this:
Solved: REST API to get role names (RLS) from power bi se... - Microsoft Fabric Community

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.