cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
elitekrishnan Frequent Visitor
Frequent Visitor

Publishing Power BI Report files to On Prime Power BI Report Server using command line utility

Hi,

I need to upload my Power BI Report files to Power BI Report Server. I have tried with PowerShell Utility ReportingServicesTools for SSRS Report and able to publish the SSRS reports in Power BI Report Server, but the same code is not working for PBIX files. I am able to publish using Power BI Desktop (October 2017) and able to upload through Power BI Reporting portal.

 

Is there any option available to upload the Power BI Report files(PBIX) to On Prime Power BI Report Server using 

  • command line utility like Rs.exe for SSRS? , have tried with RSPowerBI.Exe, not sure about the parameter list. 
  • or using PowerShell command?

Thanks,

Navaneethakrishnan Thangaraj

1 ACCEPTED SOLUTION

Accepted Solutions
Power BI Team krisztb
Power BI Team

Re: Publishing Power BI Report files to On Prime Power BI Report Server using command line utility

Hi Navaneethakrishnan,

 

 

Try the Write-RsRestCatalogItem PowerShell command (https://github.com/Microsoft/ReportingServicesTools/blob/master/ReportingServicesTools/Functions/Cat...)

 

Hope this helps,

Krisztian

10 REPLIES 10
Power BI Team krisztb
Power BI Team

Re: Publishing Power BI Report files to On Prime Power BI Report Server using command line utility

Hi Navaneethakrishnan,

 

 

Try the Write-RsRestCatalogItem PowerShell command (https://github.com/Microsoft/ReportingServicesTools/blob/master/ReportingServicesTools/Functions/Cat...)

 

Hope this helps,

Krisztian

elitekrishnan Frequent Visitor
Frequent Visitor

Re: Publishing Power BI Report files to On Prime Power BI Report Server using command line utility

Hi Krisztian,

 

Thanks for your help. It is working. 

Plantje Regular Visitor
Regular Visitor

Re: Publishing Power BI Report files to On Prime Power BI Report Server using command line utility

 

Hi,

 

Could you give any additional pointers? I am trying to do the same thing and I have tried dozens of shell commands by now. Most of them don't return an error, but none of them results in the report being published to the report server. What am I doing wrong? Is there some sort of logging?

 

This is part of what I have tried so far:

PS F:\> ./Write-RsCatalogItem -ReportServerUri 'http://localhost:8080/reports' -Path f:\test.pbix
PS F:\> ./Write-RsCatalogItem -ReportServerUri 'http://localhost/reports' -Path f:\test.pbix
PS F:\> ./Write-RsCatalogItem -ReportServerUri 'http://localhost/reports' -Path f:\test.pbix -rsfolder /Archief
PS F:\> ./Write-RsCatalogItem -ReportServerUri 'http://localhost:8080/reports' -Path f:\test.pbix -rsfolder /Archief
PS F:\> ./Write-RsCatalogItem -ReportServerUri "http://localhost:8080/reports" -Path f:\test.pbix -rsfolder /Archief
PS F:\> ./Write-RsCatalogItem -ReportServerUri "http://localhost:80/reports" -Path f:\test.pbix -rsfolder /Archief
PS F:\> ./Write-RsRestCatalogItem -ReportServerUri "http://localhost:80/reports" -Path f:\test.pbix -rsfolder /Archief
PS F:\> ./Write-RsRestCatalogItem -ReportServerUri "http://localhost/reports" -Path f:\test.pbix -rsfolder /Archief
PS F:\> ./Write-RsRestCatalogItem -ReportServerUri "http://bidb01a/reports" -Path f:\test.pbix -rsfolder /Archief
PS F:\> ./Write-RsRestCatalogItem -ReportPortalUri "http://bidb01a/reports" -Path f:\test.pbix -rsfolder /Archief
PS F:\> ./Write-RsRestCatalogItem -ReportPortalUri "http://localhost/reports" -Path f:\test.pbix -rsfolder /Archief
PS F:\> ./Write-RsRestCatalogItem -ReportPortalUri "http://localhost/reports" -Path f:\test.pbix
PS F:\> ./Write-RsRestCatalogItem -Path f:\test.pbix
PS F:\> ./Write-RsRestCatalogItem -ReportPortalUri 'http://bidb01a:8080/Reports' -Path f:\test.pbix
PS F:\> ./Write-RsRestCatalogItem -ReportPortalUri 'http://bidb01a:8080/Reports' -Path f:\test.pbix
PS F:\> ./Write-RsRestCatalogItem -ReportPortalUri 'http://bidb01a:8080/Reports' -Path 'f:\test.pbix'
PS F:\> ./Write-RsRestCatalogItem -ReportPortalUri 'http://localhost:8080/Reports' -Path 'f:\test.pbix'
PS F:\> ./Write-RsRestCatalogItem -ReportPortalUri 'http://localhost/Reports' -Path 'f:\test.pbix'
PS F:\> '

 

Thanks!

bhanson41 Member
Member

Re: Publishing Power BI Report files to On Prime Power BI Report Server using command line utility

http://byobi.com/2018/04/programmatically-deploy-power-bi-reports-to-power-bi-report-server/

Try creating a session to your report server like the link shows. I'll replace some variables in the code below.

  • X = report server uri
  • Y = path to file
  • Z = folder you're writing to. Be sure to write a "/" in front of it

 

$session = New-RsRestSession -ReportPortalUri X

Write-RsRestCatalogItem -WebSession $session -Path Y -RsFolder Z

 

Let me know if it works.

Plantje Regular Visitor
Regular Visitor

Re: Publishing Power BI Report files to On Prime Power BI Report Server using command line utility

Thank you for your reply.

 

I looked at the documentation under the link. Seems straight forward. I am still struggeling somewhat. First of all: our development machine is a Windows Server 2012, whereas the A and P machines are Windows Server 2016.

So, on the development server I first needed to run "PackageManagement_x64.msi" in order to be able to use "Install-Module" in the first place.

Next up, unfortunately, none of our servers are connected to the internet, so there is no way to have the server download "nuget" automatically as soon as it is needed (which is right after running the "Install-Module" command I guess).

 

Tried a "solution" that I found to copy the file Microsoft.PackageManagement.NuGetProvider.dll from a Windows 10 machine that does have internet. But then I get the next error message.

PS F:\powershell\reportingservicestools> Install-Module ReportingServicesTools

PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'ReportingServ

icesTools'.

At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\PSModule.psm1:1417 char:21

+             $null = PackageManagement\Install-Package @PSBoundParameters

+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   + CategoryInfo         : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex

   ception

   + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

 

This is getting pretty frustrating... what happened to good old command line options using the command prompt? Smiley Sad

elitekrishnan Frequent Visitor
Frequent Visitor

Re: Publishing Power BI Report files to On Prime Power BI Report Server using command line utility

Hi,

 

In this post, he mentioned about datasource connection string update, but this is not working, I have posted in separate thread. 

 

http://community.powerbi.com/t5/Report-Server/Power-BI-Reports-Connection-String-change-on-Power-BI-...

 

As per Jon-Heide reply, as of now connection string update is not supporting for Power BI Reports after publish.

Kindly let me know if this is working for you.

 

Thanks,

Navaneethakrishnan Thangaraj

elitekrishnan Frequent Visitor
Frequent Visitor

Re: Publishing Power BI Report files to On Prime Power BI Report Server using command line utility

Hi Plantje,

 

I had same problem to download PowerShell modules form internet. For alternate , you can download the PS module and extract it to your windows server and import it in the begining of your script file, then it will work.

 

 

Import-Module -Name F:\PowerShell\ReportingServicesTools

 

Thanks,

Navaneethakrishnan Thangaraj

Plantje Regular Visitor
Regular Visitor

Re: Publishing Power BI Report files to On Prime Power BI Report Server using command line utility

Great! This seems to work!

 

So, rather than using "install-module" I can also use "Import-Module" all else is the same as it seems.

 

Thank you VERY VERY much!

sprasad Member
Member

Re: Publishing Power BI Report files to On Prime Power BI Report Server using command line utility

Hi,

 

Once the report is uploaded on to the Report Server I wanted to input the SQL database credentials. What would be the commandline syntax to use this utility?

 

Thanks