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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Can the Rest API change the connection string (username/password) of a published dataset?

I know I can do it in PBI Desktop.  But that's no help to me.  The API claims to be able to update connections...

 

https://msdn.microsoft.com/en-us/library/mt748181.aspx

 

but I can't get it to work at all.  Keep getting '400 Bad Request'.  I'm starting to think the API doesn't work too well.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Finally worked it out - it's not possible.

 

For some reason, the Rest API is documented twice.  Once on msdn and once here...

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

 

And you can see on the apiary page that SetAllConnections only works on direct query connections.

View solution in original post

5 REPLIES 5
ankitpatira
Community Champion
Community Champion

@Anonymous Fact that there is MSDN article on it means it is certainly possible. You just need to troubleshoot the error you're getting.

Anonymous
Not applicable

I've tried everything.  I keep getting a 400 Bad Request error.

 

MSDN states the url is:

https://api.powerbi.com/v1.0/myorg/myorg/datasets/{dataset_id}/Default.SetAllConnections

 

I assume the /myorg/myorg is a typo.  Otherwise I get a 404 error.

 

I'm passing in the exact json in the MSDN article.  And using the PostRequest sample code provided by microsoft.  However, it's interesting that the sample code I got from MSDN does not include a call to SetAllConnections...

https://msdn.microsoft.com/en-us/library/mt186159.aspx

 

Can anyone actually confirm this API call works?

 

Anonymous
Not applicable

Finally worked it out - it's not possible.

 

For some reason, the Rest API is documented twice.  Once on msdn and once here...

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

 

And you can see on the apiary page that SetAllConnections only works on direct query connections.

Anonymous
Not applicable

We need to change connection strings for Tabular model/ SAAS and its not possible through this API because its not a direct query.

 

Is there any otjer way to do this?

Anonymous
Not applicable

It sure looks like it should be possible.  However I can't get it to work.

 

Basically I'm doing an HTTP POST to:

https://api.powerbi.com/v1.0/myorg/datasets/9e396f95-f576-4dc0-adf7-967612e25a46/Default.SetAllConne...

 

with a body of:

{"connectionString":"data source=xxx.database.windows.net;initial catalog=ElasticDBQuery;user id=xxx;password=xxx;"}

 

I've tried lots of things but I always get:

The remote server returned an error: (400) Bad Request.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors