Migrating Report Server Content via PowerShell

Generally, users have 2 different Report Server environments: test and production. The test environment is for designing, iterating and stabilizing new content while the production environment is for consuming that content. In the past, users used SQL Server Data Tools in Visual Studio to achieve this. However, with the introduction of Mobile Reports in SQL Server Reporting Services 2016 and the addition of Power BI Reports and Excel Workbooks in Power BI Report Server, a new solution is needed in migrating content between environments.

In this blog post, I am going to focus on Migration in SQL Server Reporting Services 2017 and Power BI Report Server (October 2017).

Prerequisites

You will also need ReportingServicesTools, which you can either clone from https://github.com/Microsoft/ReportingServicesTools or download the latest stable version of this module from the PowerShell Gallery (https://www.powershellgallery.com/packages/ReportingServicesTools).

Migrating Content for SQL Server Reporting Services 2017 and Power BI Report Server (October 2017)

The general process behind migration will involve downloading the content from test server to some temporary location on local machine and then deploying all items in the temporary location to the destination server. Ideally, it would be awesome if content could be migrated without having to be downloaded somewhere, but currently migration will require downloading the content.

Downloading Content via REST API

First I recommend you to create a new WebSession using the following command. While creating a WebSession is not necessary, by doing so, you won’t have to enter the Report Portal URI in all the other commands. To create a WebSession, you run the following:

$session = New-RsRestSession -ReportPortalUri http://pbirs/reports

Next you need to decide where you want to download the content to. In the following example, I am downloading a Power BI Report (called MyPowerBIReport) located in “/” directory to “C:\Users\admin\Downloads”.

Out-RsRestCatalogItem -WebSession $session -RsItem "/MyPowerBIReport" -Destination "C:\Users\admin\Downloads"

If you want to download everything under a specific folder, you can run the following command:

Out-RsRestFolderContent -WebSession $session -RsFolder "/" -Destination "C:\Users\admin\Downloads"

Note: If you want to download everything under a specific folder including all sub-folders (and items found in them), you should specify -Recurse switch at the end of the command.

Deploying Content via REST API

The instructions for deploying content via REST API can be found here.

Add a Comment

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