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.
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
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 firstname.lastname@example.org 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.
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 email@example.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#.