Forum Discussion

accountingbob's avatar
accountingbob
New Member
2 years ago

Connecting Semantic Model to Cloud Data Source via API

Hi All,

 

My company uses an automated process using the PowerBI Rest API to create workspaces for our clients. Previously, when we created a new workspace, the server would upload the Semantic Model files and then update the usernames and passwords that the model used to connect to the database.

 

However, this meant that each model had its own copy of the usernames and passwords, so a recent password change for the database user took us down for about a day, so a co-worker pointed all of the semantic models to use Cloud Datasource Connections as seen here in the semantic model settings:

The problem is that I cannot figure out a way to set these values via the PowerBI rest api. I fear I may be out of luck for now since the header for the "Manage data connections and gateways" page has the word "(Preview)". 

 

I have tried to use my browser's dev tools to reverse engineer what the power bi site is doing to set these values, but when I click the apply button it doesn't call into https://api.powerbi.com like the other endpoints, but instead calls https://wabi-us-central-a-primary-redirect.analysis.windows.net/metadata/datamovement/models/<someIntegerModelIdNumber>/explicitBind?api-version=10.0

 

I would just try calling this api using the same bearer token from the reguular api, but I have no idea where to get the <someIntegerModelIdNumber> since the only model identifiers I have are all guids and this seems more like a database row id. Plus I need to find some way to get the id's of the Blob and Database connections.

 

Anyone know how to get around this?

14 Replies