Forum Discussion
AndrewSEA
Advocate II
8 years agoUSERNAME() returning weird e-mail format
I'm using USERNAME() to check against a security table for Row Level Security (RLS) based on the user. For one of the users, I'm getting a weird e-mail format returned: live.com#john.doe@outlo...
GilbertQ
Super User
8 years agoHi there
The reason that it appears that way is because that is how the display name is stored in Azure Active Directory.
I would suggest changing it to USERPRINCIPALNAME() which is for the Power BI Service.
USERNAME() is for when you are inside a domain.
And finally in your lookup table store just the email address [email protected] it will correctly resolve it with the USERPRINCIPALNAME() lookup
The reason that it appears that way is because that is how the display name is stored in Azure Active Directory.
I would suggest changing it to USERPRINCIPALNAME() which is for the Power BI Service.
USERNAME() is for when you are inside a domain.
And finally in your lookup table store just the email address [email protected] it will correctly resolve it with the USERPRINCIPALNAME() lookup
- AndrewSEA8 years ago
Advocate II
Thanks, I'll try USERPRINCIPALNAME() and see if that works. Need the user with that e-mail to verify. Looks like you can't emulate it using Test as Role on the PowerBI Service.
- GilbertQ8 years ago
Super User
Hi there,
If you have a gmail or hotmail address you could test it yourself.
You are correct in that the test a role doesn't work- AndrewSEA8 years ago
Advocate II
Thanks for the tip on gmail. I used that and I'm getting the "live.com#[email protected]" coming through using USERPRINCIPALNAME() as well. It looks like USERNAME() and USERPRINCIPALNAME() work the same on the PowerBI Service according to the documents I found.
On the bright side, the user came back and has access now since I put the "live.com#[email protected]" in my look up table, so at least I have a workaround. Do you know if it will always be live.com# prefix?