最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

powerbi - Is it possible to bind a Cloud Connection datasource in Power BI using the API with a Service Principal? - Stack Overf

programmeradmin0浏览0评论

I have been using the Power BI API to bind a gateway and a couple of datasources to a datamodel. However, my datamodel is also connected to a cloud datasource, which obviously has no gateway related.

The Gateway and Cloud Connections menu on my datamodel looks like this:

I assigned the gateways using the API call:

.0/myorg/datasets/{datasetId}/Default.BindToGateway

I did this with the Service Principal after claiming ownership of the datamodel for the Service Principal.

In order to get the "datasourceID" and "gatewayID" for the cloud datasource I wanted to bind through the API, I manually configured the cloud datasource to a different datamodel (auxiliary datamodel) in Power BI Service with an admin user. Then, I used the response from this API call:

.0/myorg/groups/{workspaceId}/datasets/{datasetId}/datasources

on the auxiliary datamodel to obtain the "datasourceID" and "gatewayID" for this cloud datasource. (It makes little sense to me that it has a "gatewayID" related.) To be sure, I repeated the step with a second auxiliary model to check if the "datasourceID" and "gatewayID" were consistent, and they were.

Response from the datasources call:

If I try to refresh the datamodel with the configuration shown in the first image, it won't work since the mapped "Personal Cloud Connect" is not set (and, as far as I understand, it's not settable for the Service Principal). If I take over the datamodel with my admin user manually in Power BI Service, it will automatically configure my "Personal Cloud Connection." If it is configured, it will refresh; if not, it won't be able to refresh.

However, when I try to use the same logic for binding the desired cloud datasource as I did for the gateways, the API call:

".0/$tenantId/groups/$workspaceId/datasets/$datamodelId/Default.BindToGateway"

with body

"{'gatewayObjectId': '88c5bf1b-aaaaaaaaaaaaaaaaaaaaaaaaaaa', 'datasourceObjectsIds': '3395bac9-aaaaaaaaaaaaaaaaaaaaaaaaaaa'}"

will response with this error in Bruno

Error 400: { "error": { "code": "BadRequest", "message": "Bad Request", "details": [ { "message": "Invalid value", "target": "bindToGatewayRequest.datasourceObjectIds" } ] } }

And this error in PowerShell with Invoke-RestMethod:

Invoke-RestMethod: { "error": { "code": "DMTS_CanNotFindMatchingDatasourceInGatewayError", "pbi.error": { "code": "DMTS_CanNotFindMatchingDatasourceInGatewayError", "parameters": {}, "details": [], "exceptionCulprit": 1 } } }

How can I resolve this issue? Thank you!

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论