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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.