1 / 11

Row-Level Security for Embedding Solution

Addend Analytics is a Microsoft Power BI-partner based in Mumbai, India. Apart from being authorized for Power BI implementation, Addend has successfully executed Power BI projects for 100 clients across sectors like financial services, banking, insurance, retail, sales, manufacturing, real estate, logistics, and healthcare in countries like the US, Europe, Australia, and India. Companies partnering with us save their valuable time and efforts of searching and managing resources while saving hugely on the development costs and hence, most small and medium enterprises in North America prefer Addend to their Power BI implementation partner. Get a free consultation now by emailing us at kamal.sharma@addendanalytis.com.

Download Presentation

Row-Level Security for Embedding Solution

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Row-Level Security For Embedding Solution

  2. Power BI embedding is a Platform-as-a-service (PaaS) provided my Microsoft Azure that allows independent service vendors (ISVs) to embed visuals, reports, and dashboards into an application. However, the major challenge that occurs is that clients have access to full data report which is not required. So, we want to restrict users to data related to them and to obtain corresponding graphs and visuals. This can be easily achieved by using the row-level security feature provided by Power BI, and this can be incorporated in embedding solutions as well with the help of Power BI API calls.

  3. Add Roles in Power BI Desktop • The first and foremost step is to set up the user’s roles in your reports in Power BI Desktop. •  Now, before doing so check that the tables are filtering each other as required. This is an important step since to set up the row level security our user’s username or email is going to be used to filter the whole dataset. This is the data schema for this use case. Thus, as per the schema, we are using the attribute mail from Representatives table to execute row-level security. The sample table is as follows:

  4. Here we are filtering data as per the Manager’s email. So whenever, the Bob will login then he can view report for his representatives and when Gina will login then she can look the performances of representatives working under her. • Now, once the schema is configured, we will now add roles. • On the modelling tab, select Manage Roles. • 2. A new window mentioned below will open up. Then select Create under manage roles.

  5. 3. Set the name of your role as Manager as shown below. 4.Now, select the ellipses beside the table Representative. Then select Add filter., and the select the attribute you are going to use for filtering the users. Here we are filtering using the mail of the managers.

  6. 5. After selecting the required attribute for RLS, you will not need to define the roles using DAX. Now for this use case we are assigning roles dynamically - as per the user username / email ID. • Thus, the DAX function is: • [mail] = USERNAME () Once the role is defined. Click on Save. 6.Now to check if the defined roles are filtering or not, again go to the Modelling tab and from security select View as.

  7. 7. The following window will pop-up. Now, select the checkbox Other User and Manager. In box beside the other user, write the user you want to view the reports as. Then click on OK. 8.Now you will see that you are viewing the report as the mentioned user in last step.

  8. Add roles in Embed Token Server-Side Code // Retrieve the selected report var report = client. Reports.GetReportInGroup(“enter your workspaceid”, newGuid(“enter your reportid”)); // Generate an embed token to view vargenerateTokenRequestParameters = newGenerateTokenRequest( TokenAccessLevel.View, newEffectiveIdentity( username: “Gina@gmail.com”, // Change as per the logged in user roles: new List<string> { "Manager" }, // Names of role defined in Power BI Desktop datasets: new List<string> { report.DatasetId } ) ); var tokenResponse = client. Reports.GenerateTokenInGroup(“enter your workspaceid”, report.Id, generateTokenRequestParameters); // Populate embed variables (to be passed client-side) embedToken = tokenResponse.Token; embedUrl = report.EmbedUrl; reportId = report.Id;

  9. Client-Side Code // Read embed token varembedToken = "<% =this.embedToken%>"; // Read embed URL varembedUrl = "<% =this.embedUrl%>"; // Read report Id varreportId = "<% =this.reportId%>"; // Get models (models contains enums) var models = window['powerbi-client']. models; // Embed configuration is used to describe what and how to embed // This object is used when calling powerbi.embed

  10. var config = { type: 'report', tokenType: models. TokenType.Embed, accessToken: embedToken, embedUrl: embedUrl, id: reportId, settings: { filterPaneEnabled: true, navContentPaneEnabled: true } }; // Embed the report within the div element var report = powerbi.embed(embedDiv, config); So, this is how you can implement Row-level security for your embedding solution.

  11. About Addend Analytics Addend Analytics is a Microsoft Power BI-partner based in Mumbai, India. Apart from being authorized for Power BI implementation, Addend has successfully executed Power BI projects for 100+ clients across sectors like financial services, banking, insurance, retail, sales, manufacturing, real estate, logistics, and healthcare in countries like the US, Europe, Australia, and India. Companies partnering with us save their valuable time and efforts of searching and managing resources while saving hugely on the development costs and hence, most small and medium enterprises in North America prefer Addend to their Power BI implementation partner. Get a free consultation now by emailing us at kamal.sharma@addendanalytis.com.

More Related