Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have a semantic model that is connect to 2 datasoruces:
Our purpose is to automate the assignment of a connection to all datasources for each semantic model every time the semantic model is uploaded/modified.
For on prem datasources, we're using a Gateway and we're using the "BindToGateway" API (Datasets - Bind To Gateway - REST API (Power BI Power BI REST APIs) | Microsoft Learn) by passing the gateway object id (private/custom on prem gateway) and the datasourceobjectid (the credentials connection).
We're trying to use the same API for cloud Gateway, but it does not work (below some powershell logs of the error). How do we use this API in order to make it work also for cloud gateways? There is another API that we can use for this purpose?
HTTP POST groups/xxxx/datasets/yyy/Default.BindToGateway with json
{
"datasourceObjectIds": [
"zzzz"
],
"gatewayObjectId": "kkkk"
}
[31;1mInvoke-PowerBIRestMethod : [31;1mOne or more errors occurred. ({[0m
[31;1m[31;1m "code": "DMTS_CanNotFindMatchingDatasourceInGatewayError",[0m
[31;1m[31;1m "pbi.error": {[0m
[31;1m[31;1m "code": "DMTS_CanNotFindMatchingDatasourceInGatewayError",[0m
[31;1m[31;1m "parameters": {},[0m
[31;1m[31;1m "details": [],[0m
[31;1m[31;1m "exceptionCulprit": 1[0m
[31;1m[31;1m }[0m
[31;1m[31;1m})[0m
[31;1m[31;1m+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
[31;1m[31;1m+ CategoryInfo : WriteError: (Microsoft.PowerBI.C…kePowerBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException[0m
[31;1m[31;1m+ FullyQualifiedErrorId : One or more errors occurred. ({[0m
[31;1m[31;1m "code": "DMTS_CanNotFindMatchingDatasourceInGatewayError",[0m
[31;1m[31;1m "pbi.error": {[0m
[31;1m[31;1m "code": "DMTS_CanNotFindMatchingDatasourceInGatewayError",[0m
[31;1m[31;1m "parameters": {},[0m
[31;1m[31;1m "details": [],[0m
[31;1m[31;1m "exceptionCulprit": 1[0m
[31;1m[31;1m }[0m
[31;1m[31;1m}),Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod[0m
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @jacopoberta ,
The BindToGateway API is specifically designed for on-premises data gateways and does not support cloud data sources directly1. This is likely why you’re encountering issues when trying to use it for your cloud data sources.
For cloud data sources, you typically don’t need to bind them to a gateway because they are already accessible via the cloud. However, if you need to manage connections or credentials for cloud data sources, you might need to use different APIs or methods. The Datasources API allows you to get and set credentials for data sources.
Best regards.
Community Support Team_Caitlyn