cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tanako1991 Regular Visitor
Regular Visitor

Re: Powershell script to change Datasource Test to Production

This maybe be a stupid question (powershell noob) but how do i do this for example if i have a folder named 'mypowerbifolder' where i have 20 pbix files in C:\Users\Tanako123\Documents\mypowerbifolder and want to run this script for all my pbix files in this folder. 

I tried to google this how to do this, which should be pretty easy i think but i couldnt understand the logic

it should be a combination of get-childitem and for each? 

thanks in advance!

cchen407etr Occasional Visitor
Occasional Visitor

Re: Powershell script to change Datasource Test to Production

I've tried the powershell script mentioned in this thread but I will always get a 400 bad request.

 

I've also tried using the API (https://app.swaggerhub.com/apis/microsoft-rs/PBIRS/2.0#/PowerBIReports/UpdatePowerBIReportDataSource) and will also get 400 bad request if I touch the connection string.

 

If anyone has any other ideas, I'm open to trying as in my organization we have multiple environments I would like to deploy to automatically.

imichalarias Frequent Visitor
Frequent Visitor

Re: Powershell script to change Datasource Test to Production

Is there any solution to this problem? We are trying to edit a PBIRS DataSource connecting to an on-premise SQL Server database, using the UpdatePowerBIReportDataSource method.

 

No matter what we edit (database name, server or user), we get a 400 bad request...

 

Our PBIRS is 15.0.1102.371 (Mai 2019).

bhanson41 Member
Member

Re: Powershell script to change Datasource Test to Production

To my knowledge, it is only possible with SSAS-based sources. It's certainly not possible with SQL Server databases.

 

You're able to attempt this with your report by: "Manage"-->"Data sources"-->"Connection string". Try to edit the connection string. It's possible in SSAS but nothing else I've ran into.

imichalarias Frequent Visitor
Frequent Visitor

Re: Powershell script to change Datasource Test to Production

@bhanson41thanx for the quick reply! I have no clue (and no understanding) why this function is limited to SSASconnections only... What were they thinking??? Let's hope it is going to be fixed soon...