汇编在嵌入式编程中的作用

In the article, How to embed a Power BI Report Server report into an ASP.Net web application, we looked at available options for embedding a Power BI Report Server report into an ASP.NET web application. Since the publication of the article, I have received several questions relating to how one goes about programmatically passing credentials for report server connection within an embedded Power BI Report Server report. The simple answer to such questions is that it is currently not possible to implement user impersonation in an embedded Power BI Report Server. However, like in most scenarios, there are workarounds that one could temporarily employ – at least until Microsoft comes up with a permanent solution to what is becoming a top requested feature at ideas.powerbi.com.

在如何将Power BI Report Server报表嵌入ASP.Net Web应用程序中的文章中 ,我们研究了将Power BI Report Server报表嵌入ASP.NET Web应用程序的可用选项。 自从文章发表以来,我收到了几个有关如何以编程方式在嵌入式Power BI Report Server报表中传递用于报表服务器连接的凭据的问题。 对此类问题的简单答案是,当前无法在嵌入式Power BI Report Server中实现用户模拟。 但是,像在大多数情况下一样,存在一些可以暂时采用的变通办法–至少直到Microsoft提出一个永久性解​​决方案为止,该解决方案正成为idea.powerbi.com上最受欢迎的功能。

以编程方式传递凭证的情况 (A Case for Programmatically Passing Credentials )

Sometimes there are instances whereby your web application needs to programmatically override credentials of the currently logged in user with those of another trusted account with elevated privileges. Say, for instance, you have a public web application (i.e. a gym website) that is accessed using anonymous authentication. This public web application has a section in its front page that displays Popular Classes during Weekdays. The Popular Classes during Weekday’s section is, in turn, an embedded SSRS or Power BI Report Server (PBIRS) report.

有时,您的Web应用程序需要使用编程方式覆盖当前登录用户的凭据,以及其他具有提升特权的受信任帐户的凭据。 举例来说,您有一个使用匿名身份验证访问的公共Web应用程序(例如,健身房网站)。 该公共Web应用程序的首页上有一个部分,显示“工作日”中的“热门课程” 。 而“工作日”部分的“ 热门课程”则是嵌入式SSRS或Power BI报表服务器(PBIRS)报表。

Now, without successful authentication to the report server (SSRS or PBIRS), the Popular Classes during Weekday’s section will not be successfully rendered in the gym website. At the same time, it is not feasible that you grant report server access for every user accessing the public web application. One viable solution, however, would be to programmatically pass credentials in the background that will be used to handle all connections to the report server and thereby removing the need to prompt site visitors for report server credentials.

现在,如果未成功验证报告服务器(SSRS或PBIRS),则在工作日部分的“ 热门课程”将无法在健身房网站上成功呈现。 同时,为每个访问公共Web应用程序的用户授予报表服务器访问权限是不可行的。 但是,一种可行的解决方案是在后台以编程方式传递凭据,该凭据将用于处理与报表服务器的所有连接,从而无需提示站点访问者提供报表服务器凭据。

Again, when evaluating what can and cannot be implemented in Power BI Report Server, it is always preferable that you compare it against SSRS. Thus, the rest of this article will focus on demonstrating options for programmatically passing credentials in an embedded SSRS report versus an embedded Power BI Report Server report.

同样,在评估在Power BI Report Server中可以实现和不能实现的内容时,始终最好将其与SSRS进行比较。 因此,本文的其余部分将集中于演示用于以编程方式在嵌入式SSRS报表与嵌入式Power BI报表服务器报表中传递凭据的选项。

嵌入式SSRS报告中以编程方式传递凭据 (Programmatically Passing Credentials in Embedded SSRS Report)

The ReportViewer control is very useful to successfully embed SSRS reports within web applications. Typically, whenever an ASP.NET embedded SSRS report is rendered within a ReportViewer control, credentials of the currently logged in user are used. However, the ReportViewer control further gives developers the ability to override credentials of the currently logged in user by either impersonating a windows identity or specifying a different network credential for connecting to an SSRS report server instance. This is made possible through a combination of creating a user-defined class (i.e. MyCustomReportCred) that implements the IReportServerCredentials interface as well as mapping the output of a method from that user-defined class to ReportViewer‘s ServerReport. ReportServerCredentials property, as illustrated in Figure 1 (the source code shown in Figure 1 is available under the Downloads section at the bottom of this article).

ReportViewer控件对于将SSRS报告成功嵌入Web应用程序中非常有用。 通常,每当在ReportViewer控件中呈现ASP.NET嵌入式SSRS报告时,都会使用当前登录用户的凭据。 但是, ReportViewer控件还使开发人员能够模拟Windows身份或指定用于连接到SSRS报告服务器实例的其他网络凭据,从而覆盖当前登录用户的凭据。 通过创建实现IReportServerCredentials接口的用户定义类(即MyCustomReportCred )以及将方法的输出从该用户定义类映射到ReportViewerServerReport的组合,可以实现此目的 ReportServerCredentials属性, 如图1所示( 图1所示的源代码位于本文底部的“ 下载”部分下)。

You can always confirm that the embedded SSRS report did indeed run under a passed credential (i.e. user test2) by checking the dbo.ExecutionLog3 view in SQL Server’s ReportServer database, as shown in Figure 2.

您始终可以通过检查SQL Server ReportServer数据库中的dbo.ExecutionLog3视图来确认嵌入式SSRS报告确实在传递的凭据(即用户test2 )下运行, 如图2所示。

嵌入式Power BI报表服务器报表中以编程方式传递凭据 (Programmatically Passing Credentials in Embedded Power BI Report Server Report)

Perhaps the fact that the current version of ReportViewer control doesn’t support rendering of .pbix (Power BI) files, makes it very difficult to programmatically pass credentials to an embedded Power BI Report Server report as we are only left with using HTML iframes/object tags for embedding Power BI Report Server reports.

也许当前版本的ReportViewer控件不支持呈现.pbix (Power BI)文件这一事实,使我们很难以编程方式将凭据传递给嵌入式Power BI Report Server报表,因为我们只能使用HTML iframe /用于嵌入Power BI Report Server报表的对象标记。

  1. The only control you have with HTML iframes/object tags is setting the URL of the embedded Power BI Report Server report. You could try passing both username and password as part of the URL in the src (source) attribute of the iframes tag as underlined below:

    使用HTML iframe /对象标记的唯一控件是设置嵌入式Power BI Report Server报告的URL。 您可以尝试在iframes标记的src (源)属性中将用户名和密码作为URL的一部分传递,如下划线所示:

    <iframe
    src=”http://test3:Password1@win-hauseq7hanj:82/Reports/powerbi/reportdemo2?rs:embed=true”>
    iframe>

    < iframe
    src =” http:// test3:Password1 @ win-hauseq7hanj:82 / Reports / powerbi / reportdemo2?rs:embed = true”>
    iframe >

    There are several issues with this approach and the biggest one that comes to mind is that URLs with embedded credentials are a security threat as users with malicious intent can sniff out credentials out of the URL. Consequently, the practice of embedding credentials in a URL gets blocked by major internet browsers. Fortunately, not all internet browsers are blocking such requests, as shown in Figure 3, whilst browsers such as Microsoft Edge and Chrome will not render an iframe whose URL contains embedded credentials, Firefox continues to support such URL requests. However, it does mean that you will have to advice users of your web application to access it using internet browsers that support URLs with embedded credentials such as Firefox.

    这种方法存在多个问题,并且想到的最大的问题是,具有嵌入式凭据的URL构成安全威胁,因为具有恶意的用户可以从URL嗅探凭据。 因此,主流互联网浏览器阻止了将证书嵌入URL的做法。 幸运的是,并非所有的互联网浏览器都阻止了此类请求, 如图3所示,而诸如Microsoft Edge和Chrome之类的浏览器将不会呈现其URL包含嵌入式凭据的iframe,而Firefox继续支持此类URL请求。 但是,这确实意味着您必须建议Web应用程序的用户使用支持带有嵌入式凭据的URL(例如Firefox)的Internet浏览器来访问它。

    Figure 3
    图3
  2. Another option is to replace your on-prem Power BI Report Server environment with the cloud-based Power BI Service. As per this link, Microsoft has released several tutorials and source code that easily allows you to embed a cloud-based Power BI report within .Net applications. As shown in Figure 4, you can then use the Web.config file to pass credentials that will be used to connect and render a Power BI report. Furthermore, you can make use of Power BI gateways to ensure that your cloud-based Power BI reports are being fed by a dataset that is hosted on-prem (within your data center).

    另一个选择是用基于云的Power BI Service替换本地Power BI Report Server环境。 通过此链接 ,Microsoft已发布了一些教程和源代码,可轻松地使您将基于云的Power BI报表嵌入.Net应用程序中。 如图4所示,然后您可以使用Web.config文件传递将用于连接和呈现Power BI报告的凭据。 此外,您可以使用Power BI网关来确保基于云的Power BI报告由本地(在数据中心内)托管的数据集馈送。

    Figure 4
    图4

    Again, there seem to be disadvantaged with this approach. For instance, if you have already invested in infrastructure and licensing of Power BI Report Server, you may not have any sufficient budget to further signup for the cloud version. As per the aforementioned link to existing Microsoft tutorials, the cloud-based solution requires not only a powerbi.com account but also an Azure AD tenant, which is usually not free. Lastly, even if cost and budgeting were not constraints for you, there are some organizations who are still reluctant to host any of their enterprise solutions (i.e. reporting, data) on the cloud.

    再次,这种方法似乎有缺点。 例如,如果您已经投资了Power BI Report Server的基础结构和许可,则您可能没有足够的预算来进一步注册云版本。 根据前面提到的现有Microsoft教程的链接,基于云的解决方案不仅需要powerbi.com帐户,而且还需要Azure AD租户(通常不是免费的)。 最后,即使成本和预算对您来说不是限制,但仍有一些组织仍然不愿意在云上托管其任何企业解决方案(即报告,数据)。

摘要 (Summary)

For a platform such as SQLShack.com, this type of article may be a level above the typical intended audience but I believe it is key that BI teams and architects alike are aware of some limitations in Power BI Report Server – with respect to user impersonation and passing credentials. I think for teams who are still considering rolling out Power BI, this article can be used to substantiate your decision to either go the on-prem or the cloud route for running Power BI environment.

对于诸如SQLShack.com之类的平台,此类文章可能超出典型的预期读者的水平,但我相信关键是BI团队和架构师都应意识到Power BI Report Server中的某些限制-关于用户模拟和传递凭据。 我认为对于仍在考虑部署Power BI的团队,本文可用于证实您决定采用本地部署还是通过云路线运行Power BI环境。

Downloads

资料下载

  • Embedded SSRS Report Solution File嵌入式SSRS报告解决方案文件

翻译自: https://www.sqlshack.com/programmatically-pass-credentials-embedded-power-bi-report/

汇编在嵌入式编程中的作用

汇编在嵌入式编程中的作用_如何在嵌入式Power BI报表中以编程方式传递凭据相关推荐

  1. dch中mysql作用_《自然》小鼠中枢神经系统中的异物反应改变肽微/水凝胶功能

    生物材料在中枢神经系统(CNS)中的实验和治疗应用方面正在广泛研究中.具有特殊性质的生物材料已被并入可植入的神经假体中,这些假体在临床上用于记录神经元活动并刺激中枢神经系统中的神经回路.另外,可注射生 ...

  2. power bi可视化表_在Power BI报表视图中创建可视化

    power bi可视化表 The Report View in Power BI can be used to create beautiful visualizations in Power BI. ...

  3. power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

    power bi可视化表 In the article, Candlestick chart for stock data analysis in Power BI Desktop, we explo ...

  4. power bi 参数_参数化Power BI报表入门

    power bi 参数 In this article, I am going to explain how we can develop parameterized Power BI reports ...

  5. 浅谈计算机教学论文,浅谈计算机在教学中的作用_优秀论文

    <浅谈计算机在教学中的作用_优秀论文>由会员分享,可在线阅读,更多相关<浅谈计算机在教学中的作用_优秀论文(5页珍藏版)>请在人人文库网上搜索. 1.浅谈计算机在教学中的作用论 ...

  6. powershell编程_对Power BI PowerShell Commandlet的编程访问

    powershell编程 In this article, I am going to demonstrate how to access the Power BI PowerShell comman ...

  7. power bi导入文件夹_从Power BI Desktop中的PDF文件导入数据

    power bi导入文件夹 Power BI Desktop is a useful reporting and analytical tool to represent data in variou ...

  8. clr20r3错误问题定位与解决_解决Power BI服务中显示时间错误的问题

    ​本文来自PowerBI星球嘉宾AgnesJ的分享,关于PowerBI Service 中显示时间的问题. 也许很多人都遇到过这个困惑,做好的可以正常显示本地时间的报告,发布到web后,时间却不正确了 ...

  9. power bi报表服务器_如何将Power BI Report Server报表嵌入ASP.Net Web应用程序

    power bi报表服务器 Every once in a while, teams from different functional areas of the business (i.e. bus ...

最新文章

  1. qt实现-给SQLITE添加自定义函数
  2. 阿里平头哥发布AIoT芯片平台“无剑”,可将芯片设计成本降低50%
  3. python利用决策树进行特征选择
  4. 高仿真的类-BeanWrapper
  5. 关于afxbeginthread时WaitForMultipleObjects不起作用
  6. REVERSE-PRACTICE-BUUCTF-27
  7. 修改PPC下的移动运营商名称为中文
  8. 计算机网络讨论课感悟,计算机网络课程学习心得体会
  9. AMD已秒英特尔全家?真的吗?来看看真正公平公正的版本吧!
  10. 如何获取QQ邮箱授权码
  11. AutoPatchnbsp;warning:zfaprod.txtnbsp;do…
  12. OUC_SE_Group04_Blog1
  13. win7 设置电脑保护色
  14. GPC规范--安全域基础概念
  15. 古墓丽影10linux,《古墓丽影:崛起》Linux 版上架 Steam
  16. Knockout.js学习笔记----绑定
  17. Springboot整合liqubase
  18. e.hash oldCap == 0 详细解读
  19. [HY000][1822] Failed to add the foreign key constraint. Missing index for constraint ‘fk_com’
  20. 论文精读《Prototypical Networks for Few-shot Learning》

热门文章

  1. ubuntu 14.04下练习lua
  2. webdriver高级应用- 操作日期控件
  3. OAuth2.0官方文档中文翻译
  4. .net项目开发工具(V2.0)异常报告专帖
  5. 网页中多层效果的灵活使用
  6. LeetCode(521)——最长特殊序列 Ⅰ(JavaScript)
  7. 句句真研—每日长难句打卡Day2
  8. c语言录像带课程设计,2019信息技术真题共16页word资料
  9. HDU1213How Many Tables
  10. 难道早上起床后就一定要喝一杯白开水吗?