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
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
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.