Forum Discussion
Is it possible to Embedded Powers BI Reports into a WinForms application?
- 10 years ago
Thank you!
Do you know some project example?
- 10 years ago
I know someone did it before but I am not aware of any samples,
Thank you!
Do you know some project example?
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:
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)
- prokurors9 years ago
Advocate III
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)
- thmakhou9 years agoNew Member
Can i please have an example of wat is needed to view a power bi report from a vs 2015 c# winform application?
- prokurors9 years ago
Advocate III
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; } } }
- thmakhou9 years agoNew Member
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
- prokurors9 years ago
Advocate III
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/
- fgreal6 years agoNew Member
Me podria indicar como llevo a cabo la integracion de powerbi con winforms
gracias
- fgreal6 years agoNew Member
Me podria ayudar indicandome como llevo a cabo la integracion de powerbi en winforms
gracias