title: Replace connection in report's datasource with ReportingServicesTools
body: <p>We have different shared datasource connections for dev/prod/local in our <code>SSRS</code> solution. When we deploy the report to the report server we need to replace datasource to the proper one. For example while I am developing report I am using <code>ds_local</code> shared connection, but before I deploy it to the dev server, I need to change it to dev. Nothing complex but developers usually forgets to update this connection and commit the report with the wrong datasource. I wrote powershell script that would automatically replace the datasource to the one we need. For that I needed to write quite a lot of code, update ReportServer database tables and so on. Then I've found very nice powershell module that actually is supposed to do everything that I did but in much easier way: <a href="https://github.com/Microsoft/ReportingServicesTools" rel="nofollow noreferrer">RportingServicesTools</a>. </p>
  
  <p>It seems to work fine, but I can't get how can I implement following scenario:</p>
  
  <ol>
  <li>Find the shared datasource that is on our reporting server using it's path+name;</li>
  <li>Replace the used datasource in the report with the one I've taken from the #1</li>
  </ol>
  
  <p>I've found following functions:
  <code>Get-RsDataSource</code> and <code>Set-RsItemDataSource</code> but as I understand right now that the first one get's just the information about the datasource and 2nd one expects the datasource object. Is there any way to retrieve shared datasource as datasource object or the only way I can do is to create the new datasource manually?</p>