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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
TKenny90
Regular Visitor

PBIRS Built-In Fields for PBIX

We have PBIRS server setup and we are using rdl and pbix files on there. The Report Server is embeded into a web app which various users use. We need to be able to restrict what each user sees on the paginated reports and the Power BI reports. For the paginated reports we are using the Built-In field of UserId. Is this available on the Power BI reports too, or is it restricted to just the paginated reports?


Thanks in advance.

7 REPLIES 7
TKenny90
Regular Visitor

@mpsrshl  Thank you for the reply, we have tried this but unfortunately the user details are the Windows credentials used to access the tabular model rather than the user who is logged into the web app.

Shahfaisal
Solution Sage
Solution Sage

There is a similar function you can use in Power BI reports.  See Row-level security in Power BI Report Server 

 

You can use username() . 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, username@contoso.com.

Thanks for the response, we have considered this but as we have hundreds of clients with multiple users we can't feasibly setup the number of Windows accounts it would need. Is the UserPrincipalName taken from the Windows credentials? And how would this be visible to us in Power BI Desktop please? 


@TKenny90 wrote:

Thanks for the response, we have considered this but as we have hundreds of clients with multiple users we can't feasibly setup the number of Windows accounts it would need. Is the UserPrincipalName taken from the Windows credentials? And how would this be visible to us in Power BI Desktop please? 


This should be no different than how you've setup the paginated reports. You mentioned you have hundres fo clients, how do you intend to setup security for them if you don't want to create those accounts? The user accounts should exist somewhere to be able to use them in Power BI.

We set permissions in a web app as to which branches a user can see. The user has an ID in the web app which is then fed through to a paginated report via custom auth. We pick this up in the UserId field (normally where I'd see the Windows user) for paginated reports and use this to filter branches based in what they can see in the web app. I was hoping I would be able to pick this UserId in a PBI report as I can the paginated reports?

 

The paginated reports and PBI reports both have Windows credentials to return the data from the data sources, which is one account per customer for us. 

I hope this helps, you can create the following role inside the PBI file, considering you are using the window user.

 

[EmployeeID] =
MAXX(
FILTER (
all('Employee'),
'Employee'[Email] = USERPRINCIPALNAME ()
|| 'Employee'[LDAPAccountID]
= MID ( USERPRINCIPALNAME (), 1, FIND ( "@", USERPRINCIPALNAME (), 1 ) - 1 )
),
'Employee'[EmployeeID]
)
 

I think you should be able to make it work. I haven't done something like this myself but see this forum post - Custom Authentication in PowerBI 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.