Forum Discussion
RLS for External guest users
- 4 years ago
Hi BipinLala26 ,
According to the official documents, USERPRINCIPLENAME() name will return the UPN that looks similar to an email address at connection time. But they don’t have a clear statement about its format when accessing with external users.
Row-level security (RLS) with Power BI - Power BI | Microsoft Docs
USERPRINCIPALNAME function (DAX) - DAX | Microsoft Docs
However, with the following, you could notice that Power BI will return email address of the external users. Distribute Power BI content to external guest users using Azure Active Directory B2B - Power BI | Microsoft Docs
For guest user [email protected], only data that belongs to the rows fully matched with this value will be displayed for him. If there is a row whose value is Tim.Scott_domainName.com#EXT#@ourOrganization.onmicrosoft.com, it won’t be displayed for the user [email protected], which is be proved by test.
Therefore, if your MS Graph API returns email address([email protected] but not Tim.Scott_domainName.com#EXT#@ourOrganization.onmicrosoft.com) of the external user, then you could take it as UPN. Conversely, you couldn’t get your expected result.
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
HI BipinLala26
You are correct that you need to use the email address [email protected] this is how it has always been.
And you can then use the email attribute for external users. The reason that you see the UPN stored differently in AAD is that is how it is stored for AAD, but under the hoods it still resolves back to the mail attribute for the user.
This is not fully documented but that is how it works.