Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ddelapasse
Helper I
Helper I

Can't connect dataset/semanticModel to Gateway using API (Azure SqlServer datasource)

Please help!   I'm trying to set up code to configure new tenants in our "app-owns-data" webapp.  I'm able to use the api to create the service principal profile, the workspace, the dataset/semanticModel BUT due to network rules we have to use gateways to reach our Azure databases and I cannot connect my new semanticModel to the gateway.

I have one workspace that was configured by hand and it works great.  I can create a semantic model and then go to the dataset settings and select the gateway.  The query works and when I add rows to the sql table and refresh the report, it updates perfectly.

So then I go to my api-created workspace and I try 

POST https://api.powerbi.com/v1.0/myorg/datasets/{datasetId}/Default.BindToGateway
using the same gateway id as above, which returns a 200, yet seem to do nothing!  When I go back into my semantic model and view lineage there's no mention of the gateway like there is in the manual workspace.

On the Datasets - Bind to Gateway api page it says "Only supports the on-premises data gateway" - mine is Azure.  Please tell me there is SOME way to do this?   Also, possibly this has to do with my service principal I use with the api missing permissions?

Sigh...so close, but now I'm STUCK.

1 ACCEPTED SOLUTION
ddelapasse
Helper I
Helper I

Answering my own question to help anyone else with this issue.  Thanks to another post I found some steps listed to connect a dataset/model to a gateway and #4 was the key:

4. The user must be assigned as a user of the data source defined on the gateway (different from being a gateway admin)

The strange thing was that the api method returned 200 yet did not work - should have returned a 403 and I would have suspected permissions sooner.


View solution in original post

2 REPLIES 2
sblommendaal
New Member

@ddelapasse running in to a similair problem, would like to change gateway via api. I'm using cloud connections, do you know how to retreive that gatewayid?

ddelapasse
Helper I
Helper I

Answering my own question to help anyone else with this issue.  Thanks to another post I found some steps listed to connect a dataset/model to a gateway and #4 was the key:

4. The user must be assigned as a user of the data source defined on the gateway (different from being a gateway admin)

The strange thing was that the api method returned 200 yet did not work - should have returned a 403 and I would have suspected permissions sooner.


Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.