Power BI 与 Spring Angular 的集成 [英] Power BI Integration with Spring Angular

查看:124
本文介绍了Power BI 与 Spring Angular 的集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 Spring/Angular 开发 Web 应用程序.

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

我需要将 Power Bi 集成到我的应用程序中,以便能够使用 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 ?

谢谢.

推荐答案

首先要知道嵌入 Power BI 有两种模式——user owns dataapp owns data.在第一种模式下,嵌入时,用户将使用自己的 Power BI Pro 帐户进行身份验证,即您的每个用户都需要 Power BI Pro 许可证.对于后者,您只需要一个主帐户",用于身份验证.实现上的差异并不大,所以我将描述app拥有数据.

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.

您需要执行以下操作:

  • 注册应用程序 - 转到 dev.powerbi.com/apps 并注册一个本机应用程序.选择授予它的权限(如果您不确定,对于您的第一次测试,只需授予所有权限).复制 guid - 这是应用 ID,也就是客户端 ID.

  • 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.

下一步是从您的应用程序进行身份验证并获取访问令牌.使用 Azure Active Directory 身份验证库 (ADAL) - 调用一些 AuthenticationContext 类的 acquireToken 方法.

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.

使用此访问令牌调用 Power BI REST API 并获取要嵌入的元素的 embedUrl,例如报告.

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.

使用 Power BI JavaScript 客户端实际嵌入这个元素.您需要初始化一个嵌入配置类并传递有关元素类型(报告、仪表板、磁贴)、在哪里找到它(embedUrl)、身份验证(访问令牌)、一些其他配置选项(显示或隐藏过滤器窗格、导航等)、要应用的过滤器等.如果您将使用上面获得的访问令牌,请将 tokenType 设置为 AAD.此令牌具有许多特权,因此出于安全原因,您可能希望改用 Embed 令牌.在这种情况下,使用访问令牌再次调用 REST API(例如 报告 GenerateTokenInGroup).

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).

调用 JavaScript 客户端的 powerbi.embed 方法传递嵌入的配置以在您的应用中可视化此 Power BI 元素.

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:

这篇关于Power BI 与 Spring Angular 的集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆