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
AndrzejRusin
Regular Visitor

Power BI embedded report - USERNAME() function returns service principal id instead of username

Hi,

We have developed a .Net web application where we embed Power BI reports in the App-Owns-Data scenario, ie. with the use of service principal.

With each request to view a report the embedToken is generated depending on the report metadata, ie. it checks what datasets it is using, whether these datasets require EffectiveIdentity etc. In other words it constructs the token according to the requirements.

In case of mixed-storage reports (composite-models) which are using two or more datasets this token generation used to work fine and we were passing the username parameter in the EffectiveIdentity element to apply the RLS in the datasets, but since recently this functionality stopped working. Normally we used the USERPRINCIPALNAME or USERNAME function to retrieve the username parameter to apply the RLS in DAX, but now in case of mixed-storage reports these functions (USERPRINCIPALNAME, USERNAME and USEROBJECTID) are all returning service principal id (in guid format).

We updated the libraries of the application to use the most up-to-date ones but this gave no effect. Our conclusion is that something was changed in PowerBI Service itself.

It is worth noting that it all works fine in case of reports based on single dataset.

Has anyone run into the same issues recenlty in their embedded solutions?

Best regards,

Andrzej Rusin

7 REPLIES 7
renatalamb
Frequent Visitor

Thank you, @AndrzejRusin! I think that will be helpful for us. Appreciate it. 🙂

renatalamb
Frequent Visitor

I know this is years later, but did you ever find a resolution? Experiencing a similar problem.

Hi @renatalamb 

Indeed it was quite long ago 🙂 We have finally raised a ticket with the support and in the end the feedback was that "when the Measure is created in the Proxy dataset and not in the core dataset , it is expected by design that in the proxy dataset the username() function will return the Service Principal object ID.

Since the measure was created in the proxy dataset and not in the core dataset then the behaviour is as expected. For the proxy dataset the user was not overriding the effective identity, and this is why they were seeing the Service Principal's App ID as the effective identity."

Unfortunately I do not remember if that solution was helpful, cause in the end we refrained from using the mixed model dataset due to performace reasons.

Best regards

Andrzej

AndrzejRusin
Regular Visitor

Hi @lbendlin 

Thank you for suggestion. We have raised a ticket already. Now we are waiting for response from support, but I was wondering if anyone else encountered such problem.

Hi,

 

There was a general issue in recent 2 weeks related to embedding reports with composite models (with DirectQuery to Power BI dataset). I don't know if the issue you encountered is from the same reason, but AFAIK that issue was resolved by Power BI so maybe you can try testing your scenario again.

Hi @AmosHersch 

Thanks for information. The issue currently still exists on our side, so I think it might have been something else.

lbendlin
Super User
Super User

That doesn't sound good. Since you have a Pro license you can consider raising a Pro ticket at https://powerbi.microsoft.com/en-us/support/pro/

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

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.