SSRS - Datasource - Update Credentials from Powershell or .rds file

Taylor, Damien 1 Reputation point

Hi All,

Have written a powershell script to assist me in automatically deploying my SSRS scripts. It most works, but I really want to automate the creation of credentials against each datasource as well.

First thought was to update the .rds file dynamically but have been unable to find description or examples of the fields that I would need to add to my .rds file:

<?xml version="1.0" encoding="utf-8"?>
<RptDataSource xmlns:xsi="" xmlns:xsd="" Name="MYDATASOURCENAME">
<ConnectString>Data Source=MYSERVERNAME;Initial Catalog=MYDBNAME</ConnectString>

Was hoping to update the "TYPE OF CREDENTIALS" field to "Database Username and Password"
and then update the username and password fields under that
Impersonate = FALSE

However no matter what I do here it always deploys as "without credentials"

I have also tried to find syntax for using the Powershell "Write-RsFolderContent" command, but unable to find anything.

Anybody able to advise on a solution?


SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,727 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 38,786 Reputation points

    There are several ways using PowerShell to change data source credentials for a report.

    Direct in report XML before you deploy

    Or using SSRS web service after deployment

    1 person found this answer helpful.
    0 comments No comments

  2. Joyzhao-MSFT 15,561 Reputation points

    Hi @Taylor, Damien
    To be honest, PowerShell is beyond my abilities. The following content is for reference only, and may not be of significance to resolving the issue:
    If updating the connection string and the data source makes use of stored credentials, you need to provide the account password.

    To update a data source connection string:

    $dataSources[0].ConnectionString = 'data source=myCatalogServer;initial catalog=ReportServer;persist security info=False'  

    To change the data source credential type:

    $dataSources[0].DataModelDataSource.AuthType = 'Integrated'  

    To change the data source username/password:

    $dataSources[0].DataModelDataSource.Username = 'domain\user'  
    $dataSources[0].DataModelDataSource.Secret = 'password'  

    Best Regards,

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments