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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
New_worker
Helper II
Helper II

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
Super User
Super User

@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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.