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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
rsb_powerbi
Frequent Visitor

Power BI Embedded Row Level Security, Couldn't load data for this visual 401 error

Hello!

Using the Sample at:

https://docs.microsoft.com/en-us/azure/power-bi-embedded/power-bi-embedded-get-started-sample

And following the article at:

https://docs.microsoft.com/en-us/azure/power-bi-embedded/power-bi-embedded-rls

 

I am unable to get RLS working on an embedded report. The error received is as below:

401.PNG

The Report works fine with RLS removed, but allowing user based RLS will be cricual to our business.

The Sample Embed token has been changed to:

 

IEnumerable<string> UserRoles = new List<string>() {"provider"};
var embedToken = PowerBIToken.CreateReportEmbedToken(this.workspaceCollection, this.workspaceId, report.Id, "10005", UserRoles);

The Role is called "provider", and has the following filter:

 

 

[provider_ID_INT] = USERNAME() || [provider_ID_INT] = "-1"

When testing this in power bi desktop with "10005" entered into other user, the RLS works perfectly.

 

 

The Report contains 3 data sets, one with a list of distinct providers, which links to two data tables based on a ID. 

The list of distinct providers has the Role applied to it.

The data sets are imported, direct query is not used.

 

I have seen similar forum posts but none with a solution.

Has anyone found an answer to this, 

Or might anyone know what i am doing wrong.

Thank You!

1 ACCEPTED SOLUTION

Hello Eric,

Thanks so much for your help, as it really narrowed down where the problem was.

It looks like the issue was with one of the packages, which was not working with RLS corectly - but would work without it. I must have taken a version from before RLS was implemented.

After updating all packages with NuGet to the latest working versions it now works with RLS correctly.

Hopefully this is of help to anyone with the same problem.

 

 

View solution in original post

8 REPLIES 8
Eric_Zhang
Employee
Employee

@rsb_powerbi

The token actually works for me when My pbix just contains one table. Do you mind uploading the pbix? I'd like to check the RLS setting in your case.

var embedToken = PowerBIToken.CreateReportEmbedToken(this.workspaceCollection, this.workspaceId, report.Id,"10005",new string[] { "provider"});

Check the simple pbix in my test.

 

I also tried recreating my embedded workspaces/starting the sample from scratch again. 

Still with the same issue.


@rsb_powerbi wrote:

I also tried recreating my embedded workspaces/starting the sample from scratch again. 

Still with the same issue.


@rsb_powerbi

Would you mind share your application? You can share me a github link or a zipped folder.

Hello Eric,

I have Messaged you a link for the zipped application file


@rsb_powerbi wrote:

Hello Eric,

I have Messaged you a link for the zipped application file


@rsb_powerbi
Thanks for sharing the application. However it works just fine in my test.  I just open it in Visual studio 2015 without changing any code. Can you double check the uploaded test?

Capture.PNGCapture1.PNG

 

If the problem persists, please upload a fiddler trace file of the network traffic when loading the report.

Hello Eric,

Thanks so much for your help, as it really narrowed down where the problem was.

It looks like the issue was with one of the packages, which was not working with RLS corectly - but would work without it. I must have taken a version from before RLS was implemented.

After updating all packages with NuGet to the latest working versions it now works with RLS correctly.

Hopefully this is of help to anyone with the same problem.

 

 

Hi RSB

 

Do you remember what version you upgraded your package to and from?

Also, what package did you have to upgrade?

 

Was it Microsoft.PowerBI.Core?

 

Thanks

Christian

Hello Eric, 

I tried uploading your power BI File and i received the same error as with my powerbi file.

However, if i remove the RLS from your file and then upload it it works fine.

 

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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