Is there a way to pre-filter a powerBI report server side? - powerbi

I have uploaded a report, and using the .net SDK I've embedded said report into my website. However we show private data for many organizations. If I edit the reports iframe url to filter the report by the users org id so they can only see data for their organization then that ends up being a URL you can edit in javascript on the client side so a use could put another id there and view some other organizations data.
Is there any way possible to filter the data a report shows before it is sent client side?
I know you can edit the report file it'self but if you have hundreds of organizations, you'd need 100 copies of the same report which is obviously a maintenance and upkeep nightmare.

I would use the "Row Level Security" (RLS) feature for this requirement. Basically you set up roles, assign users to them and assign DAX expressions to them to filter the data.
There's a good explanation of it here:
https://azure.microsoft.com/en-us/documentation/articles/power-bi-embedded-rls/
The most efficient design of RLS (from a coding and admin perspective) is if you can feed in a username variable and filter your data by that (as shown in that example).

Related

Show dashboard conditionally based on authenticated user in power bi

I have the following use case, and I appreciate that this is probably not how power-bi is intended:
I'd like a template dashboard. For which the data supplied and viewed differs per authenticated user.
A user logs in with a token via oath. This contains information on the type of dashboard he is allowed to view. When he is logged in, a query should be ran and display his data in the template dashboard.
When another user logs in (with another id), the same query is run (with different arguments/params, based on his id), but retrieves different data. It is then displayed against the same template dashboard.
Is this at all a feasible use-case in power-bi. And if it isn't, what tooling does offer this option? It seems like most dashboarding tools are tailored towards having a single set of enterprise users, use the platform for management information.
Sounds like you are after Row-Level Security functionality in Power BI. A good place to start is by reading the documentation:
https://learn.microsoft.com/en-us/power-bi/admin/service-admin-rls

Different report by logged in user

I am new to PowerBI and I have a project where I store my data on MySQL( or I will use MSSQL) server. Each user has a defined ID. Is it possible to create a user login or something like that that would show reports for different users?
Login screen with powerBI shortcode will be on my website and I would like to show powerBi report by logged user. Report screen will be the same every time, but with different numbers for different user.
I am sorry for this question, but I am new to powerBI. Is it even possible to create something like this?
Thanks for any help.
You can take a look at Row-level security.
Row-level security (RLS) allows you to restrict logged in user's access to report's data, i.e. you can show different part of your data based on logged in user.
You can setup RLS in Power BI Desktop. You can create different roles that can be assigned by generating the embed token while embedding.
Refer docs: https://learn.microsoft.com/en-us/power-bi/admin/service-admin-rls
While embedding, generate embed token based on the user who has logged in and assign the roles to it. Refer docs: https://learn.microsoft.com/en-us/power-bi/developer/embedded/embedded-row-level-security

Dataset security for embedded Power BI dashboard

We embed a Power BI dashboard in a site. We currently protect some tables using RLS. There are however some tables that also contains data not everyone may see, but we cannot protect using a simple DAX expression.
My question is whether this data is secure as long as we don't expose any component in the dashboard that displays this data? Or is there maybe a way for someone to get around the components and directly query the underlying dataset?
It depends how is this dashboard embedded. If you are using the JS client with the API, and the user who see the report has rights to edit or create, then it could change the report and access the data in the tables not currently exposed in the existing one. If the user has rights only to view it, then the data is safe.
So if you are using user owns data scenario, make sure that users has only view rights on the report. If you are using app owns data scenario, make sure the embed token is generated with view rights only (i.e. token access level is view).
Another option to access arbitrary data is the Q&A visual.

Power BI Embedded Report Picker

I have an embedded site for my users to view a report. I have one master login for Power BI that all customers are routed through.
Authentication and the request are done through a .NET backend using PowerBI.Api.V2. Everything works well when I hardcode a single reportId and embed the fullscreen iframe.
My question is for customers that have multiple reports; Is there a built in report-picker-report that I can embed where the report selection is already handled for me? Or should I work on building an interface after retrieving the list of reports my users can pick from?
No, there are no built-in pickers. Power BI provides an API interface and you must implement these for yourself. Of course, you can build these pickers and make them available for us :)
To get list of workspaces you need to call Get Groups. This will give you a list of user's workspaces. You can show their name property values to the user, but you will need their id (the guid). When you know the id of a workspace, you can list the reports in it by calling Get Reports In Group. The same way you can call Get Dashboards In Group and Get Tiles In Group.

How to apply filter in PowerBI WebApp

I have created one WebApp which is hosted on Azure IIS. I am calling PowerBI reports & Dashboards and rending them into my WebApp.
I need to apply following functionality and I am unable to find solution online.
Users can filter the data from filters available in PowerBI from Web Application.
Row Level Security can be applied when we call PowerBI reports and render into web page.
It is not clear what kind of URL you are using to embed the reports. Essentially, there are 3 URLs that you can use to display a report in your web app:
The URL taken from your browser's address bar. In this case the use of you web app needs to be logged in Power BI service and to be granted with rights to see this report. One of the disadvantages are that in your web app you will not see the report only, but the whole Power BI page (including the navigation menu at the left).
The URL taken when you share this report publicly using Publish to web. In this case only the report will be embedded in your web app (menus will not be visible), but you can't do that for reports over RLS enabled datasets (because RLS requires user's identity, while in this case the access is anonymous).
The embedUrl of the report (or tile, or dashboard) that you can obtain using the Power BI REST API. It is usually used when you have a dedicated capacity assigned to this workspace (Power BI Embedded). In this case there are two scenarios - "User own data" and "App own data". In the first one each of your users must have their own account and rights to see the report (as in #1). In the later scenario, you use one shared "master account" in your web app to get access to the report and there is no need for your users to authenticate themselves. You can take a looks at the samples to see how it works. Essentially, you need the JavaScript Power BI client, one HTML page with a and some JavaScript code to load the report in the (check powerbi.js, ReportLoader.html and ReportLoader.js files from the samples. A good place to start is this article - Tutorial: Embed a Power BI report, dashboard, or tile into an application for your customers.
To apply filters to the embedded report, you can use one of the recently new features (if I'm correct, it is available since August 2018) and add the filters in the URL. I'm not sure will this work in case #2, but I will not recommend using it anyway.
RLS is not possible with case #2. In cases #1 and #3 RLS will simply work. With #3 if you use "app own data" scenario, for the RLS to work you need to pass user's name and role when you generate the token to access the report (because otherwise for all user's requests Power BI will always see the identity of your "master account" and RLS will not make any sense). This is specified with EffectiveIdentity parameter.
You also attached "power-bi-report-server" to your question, but at the same time you are saying that your web app is running in Azure. If after all your reports are on Power BI Report Server on premise, then you can embed reports by passing rs_embed=true parameter at report's URL too. In this case to make RLS work you just need to make sure that your users are authenticated with their own accounts. Passing filters in the URL works with the recent versions too (it was broken in March 2018, but fixed in 15.0.2.389).