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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
vanessa
Post Patron
Post Patron

Power BI Embedded with RLS using Direct Query to Azure SQL DW

Hi,

 

I embedded a report into a web application using direct query to Azure SQL DW and all the visuals show up just as required.

 

But when I add RLS to the PowerBI desktop file and embed the report into the app, it says "Couldn't load the data for this visual"

 

Do I need to make any change in the EmbedSample code? (I am using the code that Microsoft has provided on github)

4 REPLIES 4
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @vanessa,

 

Yes, for RLS to work, you’ll need to pass some additional context as part of your app token:

  • username (optional) – Used with RLS this is a string that can be used to help identify the user when applying RLS rules. See Using Row Level Security with Power BI Embedded
  • roles – A string containing the roles to select when applying Row Level Security rules. If passing more than one role, they should be passed as a string array.

You create the token by using the CreateReportEmbedToken method. If the username property is present, you must also pass at least one value in roles.

 

For example, you could change the EmbedSample. DashboardController line 55 could be updated from

var embedToken = PowerBIToken.CreateReportEmbedToken(this.workspaceCollection, this.workspaceId, report.Id);

to

var embedToken = PowerBIToken.CreateReportEmbedToken(this.workspaceCollection, this.workspaceId, report.Id, "Andrew Ma", ["Manager"]);'

 

For more details about how to set up Row level security with Power BI Embedded, you can refer to this article.Smiley Happy

 

Regards

@v-ljerr-msft

 

I have already done that. RLS worked fine when the source used was SQL server table. But the visuals don't show up when the source is Azure SQL Data warehouse.

Hi, I'm struggeling qith the same problem. RLS with imported data was no problem. But now with DirectQuery I'm getting the same error. Did you find an solution?

 

Regards, Florian

@fwmetz

 

Yes. I had to update the connection string.. It worked fine after doing so.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.