Forum Discussion
Row level security help
Can I use username() for row level security instead of userprincipalname(). I have ad user name in the table but not user email. Could you please let me know if this will work. Also my table is in direct query mode so I won't be able to modify the data.
yes this approach also works
just to be sure that the name your have in the table is in the right format
Create a measure _Test = Username()
Then add this measure in a card, to see how it is formatted vs what you have in the table (maybe you will have to add the domain in the list)
7 Replies
- CookistadorSuper User
yes this approach also works
just to be sure that the name your have in the table is in the right format
Create a measure _Test = Username()
Then add this measure in a card, to see how it is formatted vs what you have in the table (maybe you will have to add the domain in the list)
- IdrissshatilaSuper User
Hello DiKi-I ,
make sure to test it in the view role before applying it, since this is a sensitive case.
- DiKi-IPost Partisan
my username is getting resolved to upn in service. I will test with the actual data once I have gateway setup.
- v-csrikanthCommunity Support
Hi DiKi-I
In addition to Idrissshatila Cookistador below additional suggestions for implementing Row-Level Security (RLS) in Power BI.
- Dynamic RLS using USERNAME() or USERPRINCIPALNAME(): Store user-to-data mappings in a table and filter based on the logged-in user dynamically.
- Using security groups: Assign roles via Azure AD security groups and filter data based on group membership.
- Testing RLS using "View as Role": Always validate roles in Power BI Desktop before publishing.
- Combining static and dynamic RLS: Use hybrid logic for more complex access control scenarios.
If the above information is helpful, please give us Kudos and mark the response as Accepted as solution.
Best Regards,
Community Support Team _ C Srikanth. - v-csrikanthCommunity Support
Hi DiKi-I
It's been a while since I heard back from you and I wanted to follow up. Have you had a chance to try the solutions that have been offered?
If the issue has been resolved, can you mark the post as resolved? If you're still experiencing challenges, please feel free to let us know and we'll be happy to continue to help!
Looking forward to your reply!
If the above information is helpful, please give us Kudos and mark the response as Accepted as solution.
Best Regards,
Community Support Team _ C Srikanth. - v-csrikanthCommunity Support
Hi DiKi-I
I wanted to follow up since I haven't heard from you in a while. Have you had a chance to try the suggested solutions?
If your issue is resolved, please consider marking the post as solved. However, if you're still facing challenges, feel free to share the details, and we'll be happy to assist you further.
Looking forward to your response!
Best Regards,
Cheri Srikanth - v-csrikanthCommunity Support
Hi DiKi-I
We haven't heard from you since last response and just wanted to check whether the solution provided has worked for you. If yes, please Accept as Solution to help others benefit in the community.
Thank you.
If the above information is helpful, please give us Kudos and mark the response as Accepted as solution.
Best Regards,
Community Support Team _ C Srikanth.