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

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.

Reply
OPB12
Frequent Visitor

change connection string via power shell bad request error

Hi,

 

I use the script to change data source .

 

Change data source connection strings with PowerShell - Power BI Report Server pre-October 2020 - Po...

but i am getting this error , i use PBIRS Version: 2.97.863.0 64-bit (September, 2021) and powershell 0.0.7.2

 

WARNING: No XSRF Token detected! This might be due to XSRF token disabled.
Failed to update data sources for '/Test=/test-Import_IT': The remote server returned an error: (400) Bad Request.
At C:\Program Files\WindowsPowerShell\Modules\reportingservicestools\Functions\CatalogItems\Rest\Set-RsRestItemDataSource.ps1:256 char:13
+ throw (New-Object System.Exception("Failed to update data ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], Exception
+ FullyQualifiedErrorId : Failed to update data sources for '/Test/test-Import_IT': The remote server returned an error: (400) Bad Request.

3 REPLIES 3
Sahir_Maharaj
Super User
Super User

It's also possible that the issue is related to the version of Power BI Report Server that you're using, or the version of PowerShell that you're using to run the script. Ensure that both are up-to-date and supported.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution?
➤ Lets connect on LinkedIn: Join my network of 13K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning
Sahir_Maharaj
Super User
Super User

There can be multiple reasons for this error, including incorrect URL, incorrect header values, incorrect request body, etc. To resolve this issue, you can try the following:

 

1. Verify the URL being used to make the REST call. Ensure that it's correct and points to the correct Power BI Report Server instance.

2. Verify the header values being used in the REST call. Ensure that they're correct and match the expected format.

3. Verify the request body being sent with the REST call. Ensure that it contains the correct values and that they match the expected format.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution?
➤ Lets connect on LinkedIn: Join my network of 13K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning
Sahir_Maharaj
Super User
Super User

The error you're encountering suggests that there's a problem with the REST call that you're making to update the data source connection string. The message "The remote server returned an error: (400) Bad Request." is indicating that the server received a request that it could not understand or process.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution?
➤ Lets connect on LinkedIn: Join my network of 13K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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