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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors