cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
powerbi-oe Frequent Visitor
Frequent Visitor

Power BI embedded: load report into web control in winforms application

Hi

So I want to load a report hosted in an Azure workspace into a desktop application.

Using the power bi cli, I've created a workspace and uploaded a pbix file. I've also got the embedurl for my report.

All the examples I've see are using an iframe to load the report. Can I not use URL directly in a browser control on my desktop application? If so, what URL do I need to use?

Thanks
9 REPLIES 9
Moderator Eric_Zhang
Moderator

Re: Power BI embedded: load report into web control in winforms application


@powerbi-oe wrote:
Hi

So I want to load a report hosted in an Azure workspace into a desktop application.

Using the power bi cli, I've created a workspace and uploaded a pbix file. I've also got the embedurl for my report.

All the examples I've see are using an iframe to load the report. Can I not use URL directly in a browser control on my desktop application? If so, what URL do I need to use?

Thanks

It is not possible to access a URL to visit reports in Power BI Embedded. When embeding a report, besides the embed URL, a token is required for authentication purpose. 

 

One exception is Publish to web in Power BI Service, as it is public so no authentication required. The reports can be accessed via a single URL, any one who has that URL can access the reports.

 

powerbi-oe Frequent Visitor
Frequent Visitor

Re: Power BI embedded: load report into web control in winforms application

I've managed to create a static HTML on disk and using the power bi JavaScript library load the report. I can then load the html file into a web browser control on a form.
Moderator Eric_Zhang
Moderator

Re: Power BI embedded: load report into web control in winforms application


@powerbi-oe wrote:
I've managed to create a static HTML on disk and using the power bi JavaScript library load the report. I can then load the html file into a web browser control on a form.

@powerbi-oe

You can do that but the embed token may expire. Although a token never expires can be generated but it is not recommended.

 

Highlighted
powerbi-oe Frequent Visitor
Frequent Visitor

Re: Power BI embedded: load report into web control in winforms application

Yes it's to embed in a winforms based application.

I believe the token expires after an hour ? How does charging/licensing work with a token that never expires, as i thought each new token generated is the used for charging purposes?

Thanks
Moderator Eric_Zhang
Moderator

Re: Power BI embedded: load report into web control in winforms application

@powerbi-oe wrote:
Yes it's to embed in a winforms based application.

I believe the token expires after an hour ? How does charging/licensing work with a token that never expires, as i thought each new token generated is the used for charging purposes?

Thanks

@powerbi-oe

How do you get your token at this moment?

Regarding a token never expires, check the sample in github.

 

var embedToken = PowerBIToken.CreateReportEmbedToken(this.workspaceCollection, this.workspaceId, report.Id,Convert.ToDateTime("2099-12-31"));
powerbi-oe Frequent Visitor
Frequent Visitor

Re: Power BI embedded: load report into web control in winforms application

I'm using the power bi CLI tool (https://github.com/Microsoft/PowerBI-Cli) to upload my pbix into a Azure workspace and then generate the required tokens.

 

Hope that makes sense? And thanks for your help! 

Moderator Eric_Zhang
Moderator

Re: Power BI embedded: load report into web control in winforms application

@powerbi-oe

If the "create-embed-token" doesn't accept an expire date parameter in your link, I'm afraid you'll have to download the git sample in my previous reply and following this tutorial. Then change the code by adding an extra parameter in the sample to get a token never expires.

 

powerbi-oe Frequent Visitor
Frequent Visitor

Re: Power BI embedded: load report into web control in winforms application

@Eric_Zhang Thanks will take a look. Re my question on charging. Looking at charging again, this in done each time a session is generated or after an hour.

 

"A session is a set of interactions between an end user and a Power BI Embedded report. Each time a Power BI Embedded report is displayed to a user, a session is initiated and the subscription holder will be charged for a session. Sessions are billed at a flat rate, independent of the number of visual elements in a report or how frequently the report content is refreshed. A session ends either when the user closes the report, or one hour after the session was initiated, whichever comes first."

 

Is this hour tied to the report token which also lives for an hour ?

 

Moderator Eric_Zhang
Moderator

Re: Power BI embedded: load report into web control in winforms application


@powerbi-oe wrote:

@Eric_Zhang Thanks will take a look. Re my question on charging. Looking at charging again, this in done each time a session is generated or after an hour.

 

"A session is a set of interactions between an end user and a Power BI Embedded report. Each time a Power BI Embedded report is displayed to a user, a session is initiated and the subscription holder will be charged for a session. Sessions are billed at a flat rate, independent of the number of visual elements in a report or how frequently the report content is refreshed. A session ends either when the user closes the report, or one hour after the session was initiated, whichever comes first."

 

Is this hour tied to the report token which also lives for an hour ?

 


@powerbi-oe

AFAIK, the token is independent of the session. The token is used to access the reports, it can be expired in one or more hours.