Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 有没有办法在Power BI网关连接中自动化数据源映射?_Powershell_Powerbi - Fatal编程技术网

Powershell 有没有办法在Power BI网关连接中自动化数据源映射?

Powershell 有没有办法在Power BI网关连接中自动化数据源映射?,powershell,powerbi,Powershell,Powerbi,我正在尝试将Power BI报告自动发布到不同的工作区,这些工作区的行为类似于开发、测试和生产环境。使用Powershell命令,我可以通过Connect PowerBIServiceAccount实现此自动化 我被困在如何自动将数据源映射到数据集选项卡(设置)中网关连接下的服务器上 我是否可以使用类似Powershell或Power BI REST API来自动化此过程?也许您的解决方案就在这里: POST https://api.powerbi.com/v1.0/myorg/groups/{

我正在尝试将Power BI报告自动发布到不同的工作区,这些工作区的行为类似于开发、测试和生产环境。使用Powershell命令,我可以通过Connect PowerBIServiceAccount实现此自动化

我被困在如何自动将数据源映射到数据集选项卡(设置)中网关连接下的服务器上


我是否可以使用类似Powershell或Power BI REST API来自动化此过程?

也许您的解决方案就在这里:

POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.BindToGateway
在请求正文中,您需要指定数据源:

{
  "gatewayObjectId": "1f69e798-5852-4fdd-ab01-33bb14b6e934",
  "datasourceObjectIds": [
    "dc2f2dac-e5e2-4c37-af76-2a0bc10f16cb",
    "3bfe5d33-ab7d-4d24-b0b5-e2bb8eb01cf5"
  ]
}

这确实有帮助。您知道如何在Powershell脚本中执行此操作吗?连接PowerBIServiceAccount,然后调用PowerBIRestMethod-ContentType应用程序/json-Url'groups/{GrpGUID}/datasets/{DsGUID}/Default.BindToGateway'-方法Post-Body'{“gatewayObjectId”:“GWGUID”,“datasourceObjectId”:[“DSOGUID1”,“DSOGUID2”]}。这个格式看起来正确吗?我得到404和写错误。我少烫发了吗?谢谢。请检查组和/或数据集的GUID。在你的URL中,你应该避免用花括号括起来,但看起来没问题。我现在不能在我这边测试这个解决方案$Group=“8d33a6a9-db16-49bf-af74-6d018c49e177”$dataset=“d40b8843-5bdf-4f58-9951-2ffd5bb0cc63”$UrlGroup=“groups/$Group/datasets/$dataset/Default.BindToGateway”检查有关权限的信息: