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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mtmdbcs
New Member

Is it possible to Embedded Powers BI Reports into a WinForms application?

Dear sirs,

 

I would like to create a WinForms applicaton and show Embedded Power BI Reports inside a WinForm.

 

Is it possible?

 

Thank you,

 

2 ACCEPTED SOLUTIONS

Thank you!

 

Do you know some project example?

View solution in original post

I know someone did it before but I am not aware of any samples,

View solution in original post

19 REPLIES 19
jocaplan-MSFT
Microsoft Employee
Microsoft Employee

It is possible. Anything that can host and iframe can embed a Power BI report.

BTW. here is a comment from @mrctito (which by some unclear reason is not available here...)

 

"it seems that webbrowser control does not support all scripts needed (..) would like to see an example of this with all the capabilities, like passing filters in URL"

 

Perhaps it would be possible to get some working example of Winforms with embedded Power BI report?

Thank you!

 

Do you know some project example?

@mtmdbcs

I found that there is a winforms with power bi embedded sample in github.

 

I have not yet tried it, but here is the link:

Winforms sample on GitHub!

 

P.S. for those who tries this out - please put some comments (or send me a message) about what was your experience with this sample (it seems I'll give it a try only after 3-4 weeks, and will put my comments here afterwards)

 

Me podria ayudar indicandome como llevo a cabo la integracion de powerbi en winforms 

 

gracias

just wanted to say, that I succesfully managed to implement power bi embeded in winform project - so, now I can say it works 🙂

(with Azure AD authentication in multi-tenant mode, with tech account that has power bi free subscription. So if anyone needs some help - let me know, perhaps I can help)

Me podria indicar como llevo a cabo la integracion de powerbi con winforms 

 

gracias

can i have an example from the gentlman who got a power bi report to show from a winform application

i am using vs 2015, .net 4.5.1 and c# for a winform application.

i was able to download from nuget the powerbi security package

but the api failed to install

 

RE: BTW, here is a tutorial I made some time ago

 

This is always good to know...
I have actually managed to run Power BI Embedded reports in a lot of scenarios ranging from
static HTML, Asp.Net MVC 5 Razor, Angular 4 Component to even Asp.Net Core 1.1 using custom
TagHelper. So I thought that logically...if any of these coding approaches supports iFrame then it should
allow me to embed Power BI Embedded reports. I said it should... For example, WPF has a WebBrowser
control though I found it a bit limited... At this stage in WPF, I could see the Power BI logo
'pumping' in a white screen but that was about it...

All in all it's not just a matter of putting an iFrame in a page, we still need to provide a reusable
mechanism which will allow rendering iFrame in combination with proper provisioned
data [embedToken, enbedUrl, reportId,... ] in order to display the requested reports
or in some cases dashboards.

In what I call the 'classic' Power BI Embedded - Workspace Collections - Workspace model 'topology',
you would need to first create a Workspace Collection on your Azure Portal account then get Access Key.
From there, you could either chose the C# Provisionsample console application. I use Visual Studio Code a lot,
so I prefer running the PowerBI-CLI interface in Powershell in Integrated Terminal panel.
Overall everything went pretty pretty straight forward and provision datas could be applicable in all cases.

 

As you may already be aware, Microsoft Team has announced significant changes about Power BI Embedded convergence
with Power BI Service API. Therefore the 'classic' Power BI Embedded model may be no longer applicable after a while.
Microsoft Team said existing Power BI Embedded project  would keep running though it is strongly suggested to start migrating...
I followed Adam Saxton [aka Guy in a Cube] video series and managed to get what I wanted through the integrate-dashboard-web-app [after registering my app...] We'll agree that the whole process is somehow a bit different...
For sake of testing simplicity I just reproduced the data in a mock data sample and managed to make it run. Nothing pretty fancy.
What would be interesting would be being able to hook the same 'integrate-dashboard-web-app' process in our own application or service.
If you have any ideas or comments, or suggestions, please be my guest...

 

Regards

BTW. Just received information (here in power bi community) that power bi embedded for existing customers will continue to work for at least a year. 

Yes indeed... I also happened to find a bit more info on what to expect on June 1st... https://powerbi.microsoft.com/en-us/documentation/powerbi-extended-pro-trial/ 😉👍
Anonymous
Not applicable

As I understand there is no more way to Embed PowerBi into Windows Forms using WebBrowser?

Btw, here are two links regarding new way of embedding

 

https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embedding/

 

I see that it states that non-AAD users use embedded token to access power BI, but in my scenario (depends on how will new pricing mess resolve though) I would like to use AAD for authorization and embedded token for report access (so that I wouldn't have to buy/manage power bi pro licences for all of my apps users)

 

https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-migrate-from-powerbi-embedded/

Can i please have an example of wat is needed to view a power bi report from a vs 2015 c# winform application?

Hi,

 

as you know there are changes going on, I have not yet migrated to the new Power BI service.

 

Not clear what have you tried so far. But there are 2 main options

a) if your report contains no sensitive data - then you can use iframe (and you can get it into winform using WebControl btw.)

https://powerbi.microsoft.com/en-us/guided-learning/powerbi-learning-6-6-publish-to-web/

 

b) if your report is contains business data, then you should go for power bi embedded (please note the following is changed due to recent changes to power bi, I have not done migration yet)

-in this case you should develop Power bi report, create workspace collection in Azure and upload your report there

-there is a power bi provision application available, that you can use to operate with power bi embedded Azure service (it's a console app and takes some time to get used to)

-in my case (it's working on the old mode, will try to update here after I will migrate to the new version, if I will do it at all... depends on the new pricing...)

 

 

This is a code to create embed token for Power BI report

One more thing regarding Provision application - after you upload you report, you have to update Connection string - you can do it using the same Provision application - there you have to enter your data source credentials

 

I hope this helps...

 

using Microsoft.PowerBI.Api.V1;
using Microsoft.PowerBI.Api.V1.Models;
using Microsoft.PowerBI.Security;
using Microsoft.Rest;
using System;
using System.Collections.Generic;
using System.Linq;

namespace PowerBiReportingService.PowerBI
{
    public class PowerReports : IDisposable
    {
        private const string APP_KEY = "sdlfjalkfjalsjdlfa..."; // you get it from Azure portal Power BI workspace collection -> Access keys
        private const string BASE_URL = "https://api.powerbi.com"; //this is the same for all
        private const string REPORT_COLLECTION = "CollectionName"; //as you named it in Azure portal
        private const string WORKSPACE_ID = "8v3a8713-...."; //this is what you get when you upload your report to power bi collection using Power BI report Provision console application - there you have option to get report Id

        private string ReportId;
        private string ReportUrl;

        private IList<Report> Reports { get; set; }

        public string AccessToken { get; set; }

        public PowerReports()
        {
            var credentials = new TokenCredentials(APP_KEY, "AppKey");

            using (var client = new PowerBIClient(credentials))
            {
                client.BaseUri = new Uri(BASE_URL);

                var reportsResponse = client.Reports.GetReports(REPORT_COLLECTION, WORKSPACE_ID);

                Reports = reportsResponse.Value;

                var report = Reports.FirstOrDefault();
                if (report == null)
                    throw new InvalidOperationException("Power BI analysis services not configured / or unexpected error!");

                ReportId = report.Id;
                ReportUrl = report.EmbedUrl;
            }
        }

        public string GetEmbedReportUrl()
        {
            var embedToken = PowerBIToken.CreateReportEmbedToken(REPORT_COLLECTION, WORKSPACE_ID, ReportId);            
            AccessToken = embedToken.Generate(APP_KEY);
            return ReportUrl;
        }

        public void Dispose()
        {
            Reports = null;
            AccessToken = string.Empty;
        }
    }
}

I know someone did it before but I am not aware of any samples,

@jocaplan-MSFT

 

Hi!

 

How about this step for embedding Power BI into WinForms application? Is it possible to register WinForms app?

 

•Step 1: Register a web app with Azure AD. You need to register your web app with Azure Active Directory (AD) so that Azure AD can identify your application when you need to access Power BI reports.

 

https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-integrate-report-register/

That's good to know!

So basically it should work the same way as it is for web application, right?

I just need a WebBrowser control -> and load iframe in it, right?

If that's true, then I guess there is no need for a demo/sample specifically for Winforms (just mentioning that it is working the same way for Winforms while presenting it for web application should do the trick 🙂

 

BTW. great stuff on youtube about power bi - keep on the good work! 🙂

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.