Forum Discussion
Row level security on Power BI Embedded, can't get Username() working
- 8 years ago
Hi Zuv,
Power BI Embedded(Azure Workspace Collections) should also support datasets configured with RLS.
In this scenario, users are authenticated and authorized by your application and App tokens are used to grant that user access to a specific Power BI Embedded report. Power BI Embedded doesn’t have any specific information on who your user is. For RLS to work, you 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",For more details about row level security with Power BI Workspace Collections, you can refer to this article. :smileyhappy:
Regards
Hi Zuv,
Power BI Embedded(Azure Workspace Collections) should also support datasets configured with RLS.
In this scenario, users are authenticated and authorized by your application and App tokens are used to grant that user access to a specific Power BI Embedded report. Power BI Embedded doesn’t have any specific information on who your user is. For RLS to work, you 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",
For more details about row level security with Power BI Workspace Collections, you can refer to this article. :smileyhappy:
Regards
- shomprabu8 years agoRegular Visitor
Does Embedded RLS work without Premium?