Forum Discussion
Row Level Security with PowerBI Embedded
Hope your dataset contains user email ids & your RLS has configured using USERPRINCIPALNAME()
Refer to this blog, for Dynamic RLS configuration.
https://community.powerbi.com/t5/Community-Blog/Dynamic-Row-Level-Security-Dynamic-RLS/ba-p/787399
I understand you are using a service principal account, But you have to pass the actual login user's email id in the below code segment. If you have multiple roles, then you have to switch the role name as well.
Example-
username: [email protected]
role: roleA
var generateTokenRequestParameters = new GenerateTokenRequest("View", null, identities: new List<EffectiveIdentity> { new EffectiveIdentity(username: "[email protected]", roles: new List<string> { "roleA"}, datasets: new List<string> { "datasetId" }) });
var tokenResponse = await client.Reports.GenerateTokenInGroupAsync("groupId", "reportId", generateTokenRequestParameters);
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
- NickHall6 years agoFrequent Visitor
Hi, thanks for the reply! I think I'm starting to understand the problem.
These reports are being disseminated to users outside of our organisation, and therefore not in our active directory. They are users stored in a SQL database on one of our sites and not in any way tied to MS.
Our goal is to have an embedded report that changes its available data depending on the roles of the user logged into the site. An example of this would be siteUserA has roleA. The PowerBI report has some rows of data that only roleA users should see. When siteUserA reaches our embedded report page, it checks their site roles and then does -something- that tells PowerBI what roles they have within the given report.
Is this possible with rls? If not, is there an alternative?
We have explored creating multiple reports and fetching a different one depending on the role of the user hitting the report page, but this is hugely impractical as we'd need 20+ versions of a single report!
Thanks again,
Nick