miércoles, 8 de noviembre de 2017

Embedding Power BI Reports with Power BI Report Server

by Kasper

A common question I get is what will we will be able to do around embedding Power BI reports with Power BI report server. To understand this it is important to look at how the Power BI reports are being integrated into SSRS.
The Power BI reports are really a new type of reports supported by Reporting services. In SQL Server 2016 we added support for mobile reports and now with Power BI Report Server we add support for Power BI reports. This means that the reports will be using the traditional reporting services framework and “content management” system which means it’s existing folder structure including all it’s security features but also it’s existing embedding framework. Now SSRS has several ways to do embedding, one is using the reportviewer control and the other is through iframe embedding. The report viewer control only works for RDL files, not for the mobile reports nor for the Power BI reports, that leaves us with the traditional IFrame embedding.  Let’s take a look at this works.
To try this I started by creating a sample report and upload it to Power BI report server:
image
This I can open and see as part of my Report Server:
image
Now let’s say I want to embed this into a regular ASP.NET application. I start by creating a blank ASP.NET web app in Visual Studio and remove all the content from my Default.ASPX  within the asp:Content tags and replace it with an asp.net Iframe, leaving my page to look like this:
1
2
3
4
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<IFRAME id="frame1" scrolling="auto" runat="server" width="1000px;" height="600px">
</IFRAME>
</asp:Content>
Now in my code behind I want to load my report:
1
2
3
4
protected void Page_Load(object sender, EventArgs e)
{
}
Running this will compile and run but will not show anything:
image
The trick here is to add the following parameter to the URL: “?rs:Embed=true” as described here in the SSRS team blog. This will generate an embedding-optimized view of the report.
Now the code looks like this:
1
2
3
4
protected void Page_Load(object sender, EventArgs e)
{
}
Now running this again give us what we want:
image
And that is it, of course this can be used in a customer application or when you want to embed into SharePoint.
A few interesting things to note here are:
  1. There are currently no ways to add parameters to the connection string, I talked to the team and this is definitely on the road map.
  2. The user who is connecting to your custom app also needs to have access to the Power BI report on the report server, this is great for internal applications but harder for extranet scenario’s. A solution to this is also on the road map.
https://www.kasperonbi.com/embedding-power-bi-reports-with-power-bi-report-server/

No hay comentarios:

Publicar un comentario

  Installing Redis-x64-3.2.100 on Windows and Running Redis Server https://medium.com/@kasunprageethdissanayake/installing-redis-x64-3-2-100...