Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

i'm currently developing a web application using Spring/Angular.

I need to integrate Power Bi in my application to be able to create datasets and reports with Spring and get the charts in Angular.

Is there any examples or tutorials to help me get started ?

Thank you.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
234 views
Welcome To Ask or Share your Answers For Others

1 Answer

First you need to know that there are two modes for embedding Power BI - user owns data and app owns data. With the first mode, when embedding, the user will authenticate itself using it's own Power BI Pro account, i.e. each of your users needs Power BI Pro license. With the later one, you need only one "master account", which will be used for authentication. The differences in the implementation aren't tremendous, so I will describe app owns data.

You need to do the following:

  • Register an application - go to dev.powerbi.com/apps and register a native application. Select which permissions to grant it (if you aren't sure, for your first tests simply grant them all). Copy the guid - this is the app ID, a.k.a. client ID.

  • Next step is to authenticate from your application and get an access token. Use Azure Active Directory Authentication Library (ADAL) for that - call some of the acquireToken methods of AuthenticationContext class.

  • Use this access token to call the Power BI REST API and get the embedUrl of the element you want to embed, e.g. report.

  • Use Power BI JavaScript client to actually embed this element. You need to initialize one embed configuration class and pass information about element type (report, dashboard, tile), where to find it (embedUrl), authentication (access token), some other configuration options (show or hide filters pane, navigation, etc.), filters to be applied and so on. In case you will use the access token acquired above, set tokenType to be AAD. This token has many privileges, so for security reasons you may want to use Embed token instead. In this case use the access token to call the REST API again (e.g. Reports GenerateTokenInGroup).

  • Call powerbi.embed method of the JavaScript client pass the embedded configuration to visualize this Power BI element in your app.

Here are some resources, that you should read:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...