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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
KRONOS
Frequent Visitor

Power BI Rest API - Update All Connections?

 Hello community, My problem is the following, I have 200 reports in power bi desktop with a data source and I need to publish using a gateway  on premise in the production environment that has a data source different from my reports and can not be changed also can't create new data source in gateway by client policies... I am investigating power bi api rest

http://docs.powerbi.apiary.io/#reference/datasets/update-all-connection-strings

to update the dataset but the code does not work for me, I do not know how to perform the post method in . net.. 

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee


@KRONOS wrote:

 Hello community, My problem is the following, I have 200 reports in power bi desktop with a data source and I need to publish using a gateway  on premise in the production environment that has a data source different from my reports and can not be changed also can't create new data source in gateway by client policies... I am investigating power bi api rest

http://docs.powerbi.apiary.io/#reference/datasets/update-all-connection-strings

to update the dataset but the code does not work for me, I do not know how to perform the post method in . net.. 


@KRONOS

If you don't have coding skill, you can use some REST API console like postman. Note that the Set All Connections only works for the datasets in DirectQuery mode. For import mode, there's no way to update the connection string, AFAIK.

 

Steps to perform the post method in postman. Where to get a bearer token?

Capture.PNG

 

A sample connection string for SQL Server database.

    {
    "connectionString": "data source=wx-sql-test-01;initial catalog=UserVoiceDB;persist security info=False"
        }

Capture.PNG

 

 

At last, add a datasource in the gateway for the datasource in the new connection string.

View solution in original post

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee


@KRONOS wrote:

 Hello community, My problem is the following, I have 200 reports in power bi desktop with a data source and I need to publish using a gateway  on premise in the production environment that has a data source different from my reports and can not be changed also can't create new data source in gateway by client policies... I am investigating power bi api rest

http://docs.powerbi.apiary.io/#reference/datasets/update-all-connection-strings

to update the dataset but the code does not work for me, I do not know how to perform the post method in . net.. 


@KRONOS

If you don't have coding skill, you can use some REST API console like postman. Note that the Set All Connections only works for the datasets in DirectQuery mode. For import mode, there's no way to update the connection string, AFAIK.

 

Steps to perform the post method in postman. Where to get a bearer token?

Capture.PNG

 

A sample connection string for SQL Server database.

    {
    "connectionString": "data source=wx-sql-test-01;initial catalog=UserVoiceDB;persist security info=False"
        }

Capture.PNG

 

 

At last, add a datasource in the gateway for the datasource in the new connection string.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.