Forum Discussion
How to update connection string for every tenant/client using power bi rest api
- 2 years ago
Hi. I'm not sure about the request of changing source from the web site. I could work, maybe, depending on the change of the sources but I wouldn't recommend it.
Considering a dataset with pure cloud sources. You can change datasources of a dataset with the power bi rest api:
https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/update-datasources-in-group
However, it's quite limitated for specific sources. If you want to work with a different source from the ones specified at the doc, you could build a parameter of the connection: https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/update-parameters-in-group
You can check videos using parameters for changing excel paths or database names.
Consideration: keep in mind that right after changing a datasource for a new string connection for the first time, for example de server o database name of sql server, the dataset will request setting the credentials to let you refresh the dataset.
On the other hand if you are working with onpremise sources it might be tricky. All sources may want to use the same gateway cluster. Then create the source for the gateway after the user changes it: https://learn.microsoft.com/en-us/rest/api/power-bi/gateways/create-datasource
I hope that helps
Hi. I'm not sure about the request of changing source from the web site. I could work, maybe, depending on the change of the sources but I wouldn't recommend it.
Considering a dataset with pure cloud sources. You can change datasources of a dataset with the power bi rest api:
https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/update-datasources-in-group
However, it's quite limitated for specific sources. If you want to work with a different source from the ones specified at the doc, you could build a parameter of the connection: https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/update-parameters-in-group
You can check videos using parameters for changing excel paths or database names.
Consideration: keep in mind that right after changing a datasource for a new string connection for the first time, for example de server o database name of sql server, the dataset will request setting the credentials to let you refresh the dataset.
On the other hand if you are working with onpremise sources it might be tricky. All sources may want to use the same gateway cluster. Then create the source for the gateway after the user changes it: https://learn.microsoft.com/en-us/rest/api/power-bi/gateways/create-datasource
I hope that helps