Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
New_worker
Helper I
Helper I

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?

1 ACCEPTED SOLUTION

@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.

View solution in original post

5 REPLIES 5
v-echaithra
Community Support
Community 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.

v-echaithra
Community Support
Community 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.

Akash_Varuna
Community Champion
Community Champion

@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

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....

@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.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.