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
kk0036
Helper I
Helper I

Row Level Security with Username() with b2b accounts

Previously when I used this as my RLS filter the Username function returned Users@userdomain.com for all of my b2b users. Now when I add and external user username() and userprinciplename() return the external version User_Userdomain.com#ext#mydomain.com. I just want to know why that might occur and if I can go back to having it return just the email in invited rather than the entire extension. 

5 REPLIES 5
GilbertQ
Super User
Super User

Hi @kk0036

 

From my testing, when you use the USERPRINCIPALNAME() function with B2B it should still return the external email address which should then map through to your table where you have got the email address stored.

 

My understanding is that what is viewed in the Azure AD Display Name, but that is not what is returned by the USERPRINCIPALNAME() function 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

I have tested too with 6 users from 3 domains with one user being newly added and one user being old. I get this long form email address now for username() and userprinciplename() for any b2b user that I add. I created a testing workspace with measures to show what the Username and UPN are for each user. I then signed in as those users to view this page, and for users added prior to yesterday both return just the email address username@userdomain.com and for any users added yesterday or after I get the ext version. 

 

So both functions now return the email address in the long form, and the old users still return the normal email address even when they are in the same external domain as the new users I added. 

 

I figured I would share a screenshot of the results in the testing report. These are two users from the same domain with different results for the username() and userprinciplename() functions. The top user was added last week, bottom user added yesterday. 

user 1.png

User 2.png

Hi there,

Could it be that it takes Azure AD a few days to sort out the email address, or possibly that someone changed it in Azure AD?




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

It hasn't lagged like this before. Typically I am able to add users to power bi reports within hours of the request. 

 

As I am really the only person that does this activity, I don't think that the user account would have been changed by anyone else. 

 

I did something just for a test. I had an account that was added as an external user test. It was working appropriately with the username() function returning the user@domain.com. I removed that account from office 365 and my AD and reinvited. Upon re-entering the username() and userprinciplename() function returned with the #EXT#. 

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.

Top Solution Authors
Top Kudoed Authors