Forum Discussion
UserName() and UserprincipalName() in Dyanmic RLS
Hello,
I have User table that contains username. And I have used that username to implement dynamic RLS.
its works fine with desktop with Username() or UserprincipalName().
But it not working in PowerBI service. I think powerBI service returns users email address instead of username. I am not sure why is happening but data is showing blank while testing using user's userName.
Do I need need to use Users Email address in my table to use in logic instead of username?.
Hello Anonymous ,
yes, your guess is right.
In Power BI Service both Username() and UserprincipalName() return the e-mail address.
See the notice from the row level security documentation:
You can use username() within this expression. Be aware that username() has the format of DOMAIN\username within Power BI Desktop. Within the Power BI service and Power BI Report Server, it's in the format of the user's User Principal Name (UPN). Alternatively, you can use userprincipalname(), which always returns the user in the format of their user principal name, [email protected].So you should change the table to the e-mail address and use UserprincipalName() already in Power BI Desktop to make the report work on both platforms in the same way.
If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution βοΈ and give it a thumbs up π
Best regards
Denis
Blog: WhatTheFact.bi
3 Replies
- selimovdMost Valuable Professional
Hello Anonymous ,
yes, your guess is right.
In Power BI Service both Username() and UserprincipalName() return the e-mail address.
See the notice from the row level security documentation:
You can use username() within this expression. Be aware that username() has the format of DOMAIN\username within Power BI Desktop. Within the Power BI service and Power BI Report Server, it's in the format of the user's User Principal Name (UPN). Alternatively, you can use userprincipalname(), which always returns the user in the format of their user principal name, [email protected].So you should change the table to the e-mail address and use UserprincipalName() already in Power BI Desktop to make the report work on both platforms in the same way.
If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution βοΈ and give it a thumbs up π
Best regards
Denis
Blog: WhatTheFact.bi- AnonymousNot applicable
Thanks selimovd .
I too tested. need to Map users email-id only to implement RLS logic in PowerBI desktop to work similar in PowerBI service.
- P00082221Frequent Visitor
I need some help with this. I am using a sharepoint list where the people column in powerbi shows the username Last, First. I tried changing the sharepoint list to show the email address so I can do RLS with UserprincipalName(), but the change does not show in powerbi desktop. It still shows username Last, First. I would like to somehow get it to show the email so RLS will work on the powerbi service side. Thank you for your help