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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
h4tt3n
Helper V
Helper V

Add data source to multiple datasets via rest api

I am managing well over a hundred PowerBI reports and need to add a data source to all the corresponding datasets. The new data source is an azure sql db with basic auth. I have attempted to do this via the power bi rest api in several different ways, unsuccessfully.

According to the documentation, there doesn't seem to be an endpoint for simply adding / posting new data sources.
https://learn.microsoft.com/en-us/rest/api/power-bi/datasets

 

I have tried the PS scripts linked to in the documentation:
https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/CreateDataso...

 

Please explain which api endpoint is the right one to use. 

 

Cheers, Mike

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

That script is for gateway data sources, not semantic model data sources.

 

Usually I would have said "use an app template"  but in your situation that won't help.

 

Generally, Power Query is allergic to the idea of dynamically adding data sources. Your only option at the moment is to do this manually. Thankfully you can copy/paste queries across Power Query editors.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

That script is for gateway data sources, not semantic model data sources.

 

Usually I would have said "use an app template"  but in your situation that won't help.

 

Generally, Power Query is allergic to the idea of dynamically adding data sources. Your only option at the moment is to do this manually. Thankfully you can copy/paste queries across Power Query editors.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors