Forum Discussion

rsb_powerbi's avatar
rsb_powerbi
Frequent Visitor
9 years ago
Solved

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:

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!

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

     

     

8 Replies

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft 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.

     

    • rsb_powerbi's avatar
      rsb_powerbi
      Frequent Visitor

      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.

       

       

    • rsb_powerbi's avatar
      rsb_powerbi
      Frequent Visitor

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

      Still with the same issue.

      • Eric_Zhang's avatar
        Eric_Zhang
        Microsoft Employee

        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.