Nii
Nii

Reputation: 568

Is there a script to Backup PowerBI Reports to .rdl similar to SSRS' rs.exe?

We've gearing up for a potential Cloud Server Migration as our In-House Server is aging and its capabilities are now being limited vs latest technologies. However, one constraint I'm looking at is the problem of Migrating our Power BI Report Server's reports.

In the past, I was able to migrate from SSRS to Power BI Report Server with the help of a script that automatically backups all Reports in the Server while also populating them in the same Folder Structure as they were in the Server.

I've done some extensive research but I haven't seen any similar approach for Power BI and I was wondering if anyone else have encountered the same problem and/or have a solution for it.

Upvotes: 2

Views: 808

Answers (2)

Sabbir Hassan
Sabbir Hassan

Reputation: 185

hope its not too late. All the solutions I found on SO/online are for SSRS. The one below is for PowerBI RS (on-prem). It downloads all PBIX files in the same structure as the server. Additional details can be found here: https://www.bluegranite.com/blog/power-bi-report-server-devops

Make sure to install/update the module beforehand:

Install-Module -Name ReportingServicesTools;

And make sure to change the following two variables:

$ReportPortalUri

and

$LocalPath

#Installmodule
#Install-Module -Name ReportingServicesTools;

#Create new web session to your Power BI Report portal
$ReportPortalUri = 'https://PBIRS-onprem/Reports'; #Replace with your report server URL
$session = New-RsRestSession -ReportPortalUri $ReportPortalUri;
$LocalPath =’C:\Users\Test\Documents\PowerBI Export\'; #Specify local folder to download assets to

#Get Power BI and Excel reports from Power BI Report Server
#NOTE: Since we use SSDT for managing SSRS reports, we only wanted to download Power BI & Excel reporting assets
$reports = Get-RsCatalogItems -ReportServerUri $ReportPortalUri -RsFolder '/' -Recurse | Where {$_.TypeName -eq 'PowerBIReport' -Or $_.TypeName -eq 'ExcelWorkbook'};

#Export each report that was selected
foreach ($report in $reports)
{
  $reportFolder = (Split-Path $report.Path).Substring(1)
  $exportPath = $LocalPath + "\" + $reportFolder;

  #Create folder if it does not exist
  if (-Not (Test-Path $exportPath))
  {
    New-Item $exportPath -ItemType Directory | Out-Null;
  }

  #Export the report
  Out-RsRestCatalogItem -Destination $exportPath -RsItem $report.Path -Overwrite -WebSession $session; 
  Write-Host "Report exported: $($report.Name)";
}

Upvotes: 0

Nii
Nii

Reputation: 568

I found a Question posted here on Stackoverflow that is centered for SSRS but somehow also works for Power BI Server. You just need to install this PowerShell Extension and fire the script away.

The only issue here is that it only backs up paginated reports (.rdl) and not .pbix or Graphical Reports.

Upvotes: 0

Related Questions