Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sebash1992
New Member

Power BI Embedded and multitenant support

Hi i am working for the first time in power bi, i have done all the reports with the deskpot, but now the issue that i am facing is the embedded of the reports in my page. The thing is that is a multi tenant application so i need to only show the data for the client that is logged to my app. Each client has a tenantId and every row has the value of the client that generated that. But i dont know how i can do the filtration. I dont know if there is possible to send from the outside the tenant and then filter using rls or if there is another way to do that.

 

Regards 

 

Sebastian

4 REPLIES 4
sebash1992
New Member

Hi i am working for the first time in power bi, i have done all the reports with the deskpot, but now the issue that i am facing is the embedded of the reports in my page. The thing is that is a multi tenant application so i need to only show the data for the client that is logged to my app. Each client has a tenantId and every row has the value of the client that generated that. But i dont know how i can do the filtration. I dont know if there is possible to send from the outside the tenant and then filter using rls or if there is another way to do that.

 

Regards 

 

Sebastian


@sebash1992 wrote:

Hi i am working for the first time in power bi, i have done all the reports with the deskpot, but now the issue that i am facing is the embedded of the reports in my page. The thing is that is a multi tenant application so i need to only show the data for the client that is logged to my app. Each client has a tenantId and every row has the value of the client that generated that. But i dont know how i can do the filtration. I dont know if there is possible to send from the outside the tenant and then filter using rls or if there is another way to do that.

 


@sebash1992

As the users are from multi tenant, so I think you'll have to use Embedding with non-Power BI users. As to filter or using RLS, RLS used to work for the old embedding model(deprecated), for the new model, the RLS feature is on the roadmap and would be released in next quarter. So at this moment, use filter in the Power BI Javascript API can be the only workaround. See a demo below.

 

<html>

 <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/jquery/dist/jquery.js"></script>

<script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script>
 
<script type="text/javascript">
window.onload = function () { 
 

var clientname = ["client1"]; //get the client name with javascript from your page

 var  Filter = {
   $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "Table",
    column: "clientName"
  },  
      operator: "Contains",
      values: clientname
     
	 
} 
    // Read embed application token from Model
    var accessToken = "H4sIAAAAAAAEAB2 xxxxx     uCwAA";

    // Read embed URL from Model
    var embedUrl = "https://app.powerbi.com/reportEmbed?reportId=1f1d9145-738a-4d20-ab5b-1236b283e942&groupId=73e1a3c6-08c4-4651-aa04-2bb701a573c7";

    // Read report Id from Model
    var embedReportId = "1f1d9145-738a-4d20-ab5b-1236b283e942";

    // Get models. models contains enums that can be used.
    var models = window['powerbi-client'].models;

    // Embed configuration used to describe the what and how to embed.
    // This object is used when calling powerbi.embed.
    // This also includes settings and options such as filters.
    // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
    var embedConfiguration = {
        type: 'report',
        tokenType: models.TokenType.Embed,
        accessToken: accessToken,
        embedUrl: embedUrl,
        id: embedReportId,
        permissions: models.Permissions.All,
		filters:[Filter,Filter2],
        settings: {
            filterPaneEnabled: true,
            navContentPaneEnabled: true
        }
    };
  
var $reportContainer = $('#reportContainer');
 
var report = powerbi.embed($reportContainer.get(0), embedConfiguration); 
 
}
</script>

<div id="reportContainer" powerbi-settings-nav-content-pane-enabled="true"   powerbi-settings-filter-pane-enabled="true"></div>

</html>

It needs to be pointed out that the proposed solution, embedding the client (essentially the tenant discriminator) in the client-side javascript, would be absolutely insecure and unsafe.

 

An attacker would need only play with the javascript to completely bypass your security and read all the data for other tenants.

It needs to be pointed out that the proposed solution, embedding the client (essentially the tenant discriminator) in the client-side javascript, would be absolutely insecure and unsafe.

 

An attacker would need only play with the javascript to completely bypass your security and read all the data for other tenants.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.