EDIT: PowerBI Workspace Collections are now retired so this method no longer works.
Finally I've managed to do that.
Here are the main steps (in case if anyone else needs to embed Power bi report into WinForms solution):
1) you need Azure subscription that has an organizational account that has assigned power bi subscription (free version is enough) - if you don't have this, you can not assign power bi service access rights
2) in azure subscription you have to create PowerBI workspace collection (here you can get access keys and workspace collection id that will be necessary to access your power bi report)
3) design your report in Power BI desktop (if it's against Azure SQL db, then you can use Direct mode even with power bi free subscription)
4) to upload your report into azure power bi workspace collection
you can use ProvisionSample project from this git hub repository
- have to register this app in your AAD and add it power bi service related permissions
- you have to create workspace (after that you can get it's id in Azure portal)
- then upload pbix file in to workspace
- if you use Azure SQL, then you have to update connection string (also possible using this solution)
- in the EmpedSample project of this solution, you can see how it's working in case if it's embedded in Web solution
- here is a link to power bi idea that requests easing this process (just in case if anyone's interested in this, too...)
5) now, to get this into winforms solution, you can use this WinformsSample project (it's not merged into master at the moment, don't know how to easily download it, but tested it and it works!)
- interesting that this app does not require registering in azure - seems like workspace collection key + related data is sufficient...
P.S. This 5th point somehow makes me a bit nervous (i.e. storing app keys in the client side code) perhaps it would be possible to move app keys to REST API side and retrieve it using REST service call - then, I guess it would be more secure... + changing app keys (there is a re-generation tool in Azure portal - see workspace collection entry) would not involve changes to client application
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…