SSRS Production Deployment, Part 2

In Part 1 we discussed that in development environemnt we deploy reports by simply clicking “Deploy” in BIDS, but this won’t work in production. To deploy reports in production we need to write an SSRS script, which is actually a piece of VB.NET code executing against SSRS web service.

A typical report consists of the report definition (the .rdl file) that references one or more data sources. And this is where things get tricky.

Deploying Data Sources

Code to deploy a data source.
Code to deploy data source and report.

You create a data source using a call to rs.CreateDataSource() method. Unfortunately, this method does not accept .rds files that BIDS uses to store data source information. Instead it wants a DataSourceDefinition object. This means that one must parse the .rds file and convert it to a DataSourceDefinition instance. Here’s a piece of code that does that. It is geared for datasources with integrated credentials, if you use other kind of credentials, you’ll need to make relevant modifications.

Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument
doc.Load(rdsPath)

Dim dataSource As DataSourceDefinition = New DataSourceDefinition
dataSource.ConnectString = doc.SelectSingleNode("/RptDataSource/ConnectionProperties/ConnectString/text()").Value
dataSource.Extension = doc.SelectSingleNode("/RptDataSource/ConnectionProperties/Extension/text()").Value
dataSource.CredentialRetrieval = CredentialRetrievalEnum.Integrated
dataSource.Enabled = True
dataSource.EnabledSpecified = True

Dim name As String
name = doc.SelectSingleNode("/RptDataSource/Name/text()").Value

Dim overwrite As Boolean = false

rs.CreateDataSource(name, "/Data Sources", overwrite, dataSource, Nothing)

This was easy, wasn’t it? Full version of the code with logging and error handling can be found here.

But data sources are only one half of the story. In Part 3 we will discuss how to deploy reports.

4 Comments




  1. Hello,

    I like your post on the deployment of rdl files.
    I had a question. How do you script deploying updates of reports with “Shared Data Source”?

    Reply

    1. To be honest, I don’t remember. This post was written over 7 years ago, and did not touch SSRS ever since.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *