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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
IbisRipley
Frequent Visitor

ReportingServicesTools Set-RsRestItemDataSource - BAD REQUEST how to diagnose?

I am attempting to write a script to update Datasource connect strings for power bi reports on PBIRS(on prem, no service)  - Trying to add a port to the ( sharepoint ) url in the connect string.  Forgive me as I am new to this and unsure how to move forward.  Script is below and it does return the connectstring with the port to screen prior to setting it.    Can anyone help with possible next steps or what might be wrong?  Thanks in advance

The last line

Set-RsRestItemDataSource -RsItem $dataSourcePath -RsItemType 'PowerBIReport' -DataSources $ds -ReportPortalUri $ReportServerURI

returns

Failed to update data sources for '/AP/CSECR/Action%20Items': The remote server returned an error: (400) Bad Request.
$ReportServerURI = "https://<svr>/Reports/"
$ReportPortalUri = "https://<svr>//PBIReports"

$dataSourcePath = "/MyReportPath"


cls

#Get-RsRestItemDataSource -RsItem $dataSourcePath -ReportPortalUri $ReportPortalUri

$dataSources = Get-RsRestItemDataSource -RsItem $dataSourcePath -ReportPortalUri $ReportServerUri
foreach($ds in $dataSources)
{
Write-Host $ds.ConnectionString

$ds.ConnectionString = $ds.ConnectionString.Replace("mydomain.com", "mydomain.com.999")
$ds.DataModelDataSource.AuthType = "Integrated"
$ds.DataModelDataSource.Username = "Adomain\user"
$ds.DataModelDataSource.Secret = "mypw"

Write-Host $ds.ConnectionString

Set-RsRestItemDataSource -RsItem $dataSourcePath -RsItemType 'PowerBIReport' -DataSources $ds -ReportPortalUri $ReportServerURI
}

 

 

 

5 REPLIES 5
DustinKeith
New Member

I am having the same issue.  I can set many of the values (e. g. Name, Description, DataModelDataSource.AuthType, DataModelDataSource.Username) but, as soon as I add in the DataModelDataSource.Secret = "mypw" it results in the Bad Request (400) error.

That rules out the cerdentials being wrong/expired.  I have tried setting the CredentialRetrieval to "prompt" and "store" with no success.

v-xiaoyan-msft
Community Support
Community Support

Hi @IbisRipley ,

 

Failed to update data sources for '/AP/CSECR/Action%20Items': The remote server returned an error: (400) Bad Request.

Have you checked the credentials? 400 usually indicates an incorrectly formatted query. In your case, however, this looks more like expired credentials.  

 

Best Regards,
Community Support Team _ Caitlyn

I am getting the same problem do you have any resolution ? 

IbisRipley
Frequent Visitor

One additional note:  I managed to get the Response body, but it doesn't help me much either.  

Response body:
Failed to update data sources for '/AP/CSECR/Action%20Items': The remote server returned an error: (400) Bad Request.
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException

In Hopes of getting some help, here is more information.   We are on 

Build File version Description Release date

15.0.1108.1591.13.8086.22725Power BI Report Server January 2022 Update Download2022-02-23 *new

 

IS it possible that this method (Parameters ) https://docs.microsoft.com/en-us/power-bi/report-server/connect-data-source-apis   would ned to be used since the method above ( from here https://docs.microsoft.com/en-us/power-bi/report-server/connect-data-source-apis <-- specifies pre-OCT 2020) would need to be used?   It seems if that is the case we would need to manually modify all reports to add parameters?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.