Forum Discussion
Connecting Semantic Model to Cloud Data Source via API
Thank you for your reply. I have been using the update datasource enpoints to update the username and password previously, but I can't find a way to list the "gateways" for the cloud data sources. I have tried the https://api.powerbi.com/v1.0/myorg/gateways endpoint and it returns an empty list. If I pull a semantic model which is already connected to the cloud datasource, the result does contain a gatewayId, but when I then try to get that gateway using https://api.powerbi.com/v1.0/myorg/gateways/{gatewayId}, I get a 404 result.
We are having that problem here as well.
Our use case is about updating credentials for a shared cloud connection that is used in a OneLake shortcut. We would like to do that programmatically, on a schedule. For non-shared connections, so far we were successful with https://learn.microsoft.com/en-us/rest/api/power-bi/gateways/update-datasource, but not for shared cloud connections.
We've looked at the network requests and responses that happen when we navigate the Power BI UI at https://app.powerbi.com/groups/me/gateways . We noticed that there is gatewayId that is used for all of them, for a gateway that is of the "TenantCloud" type, and each of these shared cloud connections has a datasourceId. However, as mentioned by accountingbob, https://api.powerbi.com/v1.0/myorg/gateways does not return that gateway id. We also tried to use these gateway id and datasource id in https://learn.microsoft.com/en-us/rest/api/power-bi/gateways/update-datasource, but that leads to an Unauthorized error.
So we are in the same situation: we cannot use the existing API to update the credentials of a shared cloud connection. The impact for us is that it is blocking us from using OneLake shortcuts, since we would have to rely on someone manually updating credentials in the UI, and that's not robust enough.