skadam85
skadam85

Reputation: 543

Is there a way to automate datasources mapping in Power BI Gateway connection?

I am trying to automate the publishing of Power BI report to different workspaces that act like Dev, Test and Prod environments. Using Powershell commands, I am able to achieve this automation via Connect-PowerBIServiceAccount.

I am stuck at how to automate the datasources mapping to the servers under Gateway connection in Datasets tab (Settings).

Is there like a Powershell or Power BI REST API that I can use to automate this process?

Upvotes: 1

Views: 1511

Answers (1)

msta42a
msta42a

Reputation: 3741

Propably your solution is here:

POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.BindToGateway

And in request body, you need to specify datasources:

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

https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/bindtogatewayingroup

Upvotes: 1

Related Questions