Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I have some PBI reports with SQL Server datasource.
Data connectivity mode is "Import".
I want to upload the .pbix files programmatically to Power BI Report Servers of our costumers and change the datasource.
The costumer datasources have the same schema but different connection strings (server name, database name).
Uploading with the API works fine.
The problem is:
1. After uploading the file we have to change the datasource manually.
2. Because of connectivity mode "Import" our test data is already loaded in the pbix file and gets uploaded to the customers report server when we upload the file.
Is there a way to change the datasource programmatically before uploading and to make sure that no data is uploaded with the report?
Thanks in advance.
Edit: From my understanding changing the datasource first, refreshing and then uploading the file should be save.
But is it possible to do this programmatically? Seems to me like its possible to upload, change datasource and refresh (in this order) with Power BI Rest API. Problem is I dont want any data to be uploaded with the file in the first case because if something goes wrong with changing datasource and refreshing it would be a huge problem to have a report with our test data on the customers report server.
Solved! Go to Solution.
Hi @MaxMuster ,
As you said, power bi not support to direct modified the datasource without open the pbix file. Have you tried to use the template file and get the data source with parameters? You can try to store your connection string to a config file, then write a custom function to analysis this file.
https://radacad.com/change-the-source-of-power-bi-datasets-dynamically-using-power-query-parameters
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
That link kind of helped, now we can upload the report with parameterized datasource and then change the parameters by rest api call. Still the problem that data gets uploaded with the report first, although its possible to trigger a refresh plan by api call so the data gets updated.
Hi @MaxMuster ,
As you said, power bi not support to direct modified the datasource without open the pbix file. Have you tried to use the template file and get the data source with parameters? You can try to store your connection string to a config file, then write a custom function to analysis this file.
https://radacad.com/change-the-source-of-power-bi-datasets-dynamically-using-power-query-parameters
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
2 | |
2 | |
1 | |
1 |