简体   繁体   English

以编程方式将Power BI报表部署到Power BI报表服务器并更改连接字符串

[英]Programmatically Deploying Power BI Reports to Power BI Report Server and change Connection String

Is there any method to deploy Power BI reports to Power BI Report Server without having to manually copy these files, upload them to the server and finally change the data source connectivity information for each report on a report by report basis which is not practical in each customer sites. 是否有任何方法可以将Power BI报表部署到Power BI报表服务器,而不必手动复制这些文件,将它们上传到服务器,最后在逐个报表的基础上更改每个报表的数据源连接信息,这在每个报表中都不实用客户网站。

Eg. 例如。 PowerBI Report File - 'Report_1' need to Deploy on Customer server S1, S2, S3, & so on. PowerBI报告文件-“ Report_1”需要部署在客户服务器S1,S2,S3等上。

Now we doing manually copy these files, upload them to the server and finally change the data source connectivity information for each report on a report by report basis which is not practical in each customer sites. 现在,我们手动复制这些文件,将它们上传到服务器,最后逐个报告地更改每个报告的数据源连接信息,这在每个客户站点中都不实际。

How we can automate the deployment of PBIX reports to Power BI Report Server and changing Datasource connection string Pro-grammatically.? 怎样才能自动将PBIX报表部署到Power BI报表服务器,并以编程方式更改数据源连接字符串。

Microsoft releasing feature in 2020 Jan to update connection string using API. Microsoft在2020年1月发布功能,以使用API​​更新连接字符串。

在此处输入图片说明

Microsoft releasing feature in 2020 Jan. But There is any way in 2019 ? 微软在2020年1月发布功能。但是在2019年有什么办法? any other way for update connection string ? 还有其他更新连接字符串的方法吗?

Microsoft Link 微软链接

This would only work if the change you need can be driven by a parameter, eg for a SQL Server source, can set database, schema or table name (but not server name). 仅当您所需的更改可以由参数驱动(例如对于SQL Server源)可以设置数据库,架构或表名(但不能设置服务器名)时,这才起作用。

First I would set up the query definitions to use query parameter(s) and test. 首先,我将设置查询定义以使用查询参数并进行测试。 The specifics of this would depend on your data sources and scenario - you have not provided any info on that. 具体情况取决于您的数据源和方案-您尚未提供任何信息。

Then I would call the appropriate REST API Update Parameters method - probably the Group version. 然后,我将调用适当的REST API 更新参数方法-可能是版本。

https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/updateparametersingroup https://docs.microsoft.com/zh-cn/rest/api/power-bi/datasets/updateparametersingroup

You can deploy using to Power BI Report Server, and change connections and other setting using Powershell using the ReportingServiceTools library, As Power BI Report Service is SSRS you can use the same tools, to load reports, change data connections etc 您可以部署到Power BI Report Server,并使用Powering通过ReportingServiceTools库使用Powershell更改连接和其他设置。由于Power BI Report Service是SSRS,因此您可以使用相同的工具来加载报告,更改数据连接等。

Example of deploying a file and here 在此处 部署文件的示例

You can also change the connection settings directly in the PBIX file. 您也可以直接在PBIX文件中更改连接设置。 If you change the extension from pbix to zip you can take a look inside. 如果将扩展名从pbix更改为zip,则可以查看内部。

Power BI内部结构 If you open the 'Connections' file, it contains the setting via a JSON structured file 如果您打开“连接”文件,则该文件将通过JSON结构文件包含设置

{"Version":1,"Connections":[{"Name":"EntityDataSource","ConnectionString":"Data Source=asazure://region.asazure.windows.net/somecubegoes her;Initial Catalog=SmartSpacesAnalysis;Cube=SmartSpacesModel","ConnectionType":"analysisServicesDatabaseLive"}]}

That can be read and changed if needed 如果需要,可以读取和更改

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM