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
Anonymous
Not applicable

RLS not working with Power BI Service

Hello,

 

I have a sales report and applied RLS security for salespeople to see just their accounts. The sales rep name is mentioned as the full name, for example, Shaikh, Abdulquadir

 

I have tried scalar function USERNAME() and USERPRINCIPALNAME() to display just their records, this works perfectly on desktop but does not work on Power BI service.

 

Also I have granted "Viewer" permission to the user. Does the column name where the name exists should be USERPRINCIPALNAME or USERNAME.

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

It should be noted that there is a difference between using the USERNAME() and USERPRINCIPALNAME() functions in Powerbi Desktop and Powerbi Service. In Desktop, the function returns not the UPN of the login account, but the local UPN. When you add a user in Desktop The result returned after the ID is correct, but if the account ID corresponding to the Service is not added in the Powerbi Service, the correct record cannot be displayed. As the above description shows that the result is empty, it illustrates this problem.

 

Username(),userprincipalname()  return from desktop

v-henryk-mstf_0-1617183601127.pngv-henryk-mstf_1-1617183643332.png

 

Username(),userprincipalname()  return from service

v-henryk-mstf_2-1617183714966.pngv-henryk-mstf_3-1617183743224.png

 


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

Best Regards,
Henry

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

4 REPLIES 4
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

It should be noted that there is a difference between using the USERNAME() and USERPRINCIPALNAME() functions in Powerbi Desktop and Powerbi Service. In Desktop, the function returns not the UPN of the login account, but the local UPN. When you add a user in Desktop The result returned after the ID is correct, but if the account ID corresponding to the Service is not added in the Powerbi Service, the correct record cannot be displayed. As the above description shows that the result is empty, it illustrates this problem.

 

Username(),userprincipalname()  return from desktop

v-henryk-mstf_0-1617183601127.pngv-henryk-mstf_1-1617183643332.png

 

Username(),userprincipalname()  return from service

v-henryk-mstf_2-1617183714966.pngv-henryk-mstf_3-1617183743224.png

 


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

Best Regards,
Henry

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

pleblanc
Employee
Employee

USERPRINCIPALNAME() is what you want to use, but it aligns with the UPN that is used to sign into to Power BI.  For example, if you use johndo3@company1.com to sign into Power BI, then that must be store in a table in the model.  Let's say the column name is EmailAddress then the DAX expression on the role would be EmailAddress = USERPRINCIPALNAME().  Check out this video https://youtu.be/MxU_FYSSnYU

Anonymous
Not applicable

@pranit828 Thanks, I am already doing this. But when I go to test this it gives me a blank report.

pranit828
Community Champion
Community Champion

Hi @Anonymous 

You are right use USERPRINCIPALNAME() adn it is good that it is working on Desktop.

On service you have to assign the ID in the Secirity section of the Dataset.

 

Go to the "Datasets + dataflows" views where your data set it.

Don't click on the dataset name instead click on the tripple dot.

pranit828_1-1617039506767.png

and select security and add the IDs to the group they belong to in addition to giving them the viewer priveledge.

 

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

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.