Forum Discussion

New_worker's avatar
New_worker
Icon for Helper II rankHelper II
1 year ago
Solved

user principal name (UPN) question

Hi-

To return UPN, should we always use USERPRINCIPALNAME()? 
May anyone help on below question and share me the document where to find the answer? Thanks.

 

Your network contains an on-premises Active Directory Domain Services (AD DS) domain named
contoso.com that syncs with a Microsoft Entra tenant by using Microsoft Entra Connect.
You have a Fabric tenant that contains a semantic model.
You enable dynamic row-level security (RLS) for the model and deploy the model to the Fabric service.
You query a measure that includes the USERNAME() function, and the query returns a blank result.
You need to ensure that the measure returns the user principal name (UPN) of a user.
Solution: You add user objects to the list of synced objects in Microsoft Entra Connect.
Does this meet the goal?

  • New_worker I think it will not fully meet the goal. Syncing user objects via Microsoft Entra Connect is necessary but insufficient on its own. You also need to configure RLS roles properly and consider using USERPRINCIPALNAME() instead of USERNAME() to ensure the UPN is returned correctly.

5 Replies

  • New_worker Yes, USERPRINCIPALNAME() should be used to get the UPN in Power BI. The issue with USERNAME() returning a blank result likely arises due to missing user objects in Entra Connect. Adding user objects to the sync list should resolve this. For more info, refer to the Power BI RLS documentation.
    If this post helped please do give a kudos and accept this as solution
    Thanks In Advance

    • New_worker's avatar
      New_worker
      Icon for Helper II rankHelper II

      Hi Akash_Varuna 
      Thanks for your reply. As my understanding, syncing user objects via Microsoft Entra Connect is a necessary precondition. But we still need other actions to make username() return the correct value in the model, right..So, I am not sure the answer should be Yes or No for this question....

      • Akash_Varuna's avatar
        Akash_Varuna
        Icon for Super User rankSuper User

        New_worker I think it will not fully meet the goal. Syncing user objects via Microsoft Entra Connect is necessary but insufficient on its own. You also need to configure RLS roles properly and consider using USERPRINCIPALNAME() instead of USERNAME() to ensure the UPN is returned correctly.

  • v-echaithra's avatar
    v-echaithra
    Icon for Community Support rankCommunity Support

    Hi New_worker ,

    We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
    If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

     

    Regards,
    Chaithra.

  • v-echaithra's avatar
    v-echaithra
    Icon for Community Support rankCommunity Support

    Hi New_worker ,

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
    If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

     

    Regards,
    Chaithra.