Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Is it possible to deploy .pbix extension on Power BI ReportServer from Team Foundation Server (TFS)?

I am trying to deploy .pbix extension on Power BI Report Server from Team Foundation Server (TFS) and getting this error:


Error Uploading or saving files with .pbix extension is not allowed. Contact your administrator if you have any questions.

 

First thing would like to know is it possible to deploy .pbix extension on Power BI Report Server from Team Foundation Server (TFS)? If not then how can I deploy 100 of .pbix reports to prod..? Pls don't say 1 by 1 and manually.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Import-Module ReportingServicesTools

$vReportServerURI = 'http://Server/Reports/'
$vRSRootFolderName = '/ABC' # /=Home and /Folder1=Folder1
$vRSFolderName = 'YYY'
$vSourceFolderPath = 'C:\MyFolder\PowerShellSource\'
$vDescription = "Deployed Power BI Report Using PowerShell"

$vDestinationFolderPath = $vRSRootFolderName +"/"+ $vRSFolderName
$vSourcePBIXFiles = Get-ChildItem -Path $vSourceFolderPath -Filter *.pbix -Recurse

$session = New-RsRestSession -ReportPortalUri $vReportServerURI

#Create Destination Folder On Power BI Report Server
try
{
New-RsRestFolder -WebSession $session -RsFolder $vRSRootFolderName -FolderName $vRSFolderName -ErrorAction Stop
Write-Host "------------------------->Created folder: $($vRSRootFolderName)/$($vRSFolderName)<-------------------------"
}

catch
{
Write-Host "------------------------->Folder: $($vRSRootFolderName)/$($vRSFolderName) exists<-------------------------"
}

 

#Upload Copy of PBIX to Destination Folder On Power BI Report Server
foreach ($vPBIXFiles in $vSourcePBIXFiles)
{

Write-Host "------------------------->SourceFilePath: $($vSourceFolderPath)$($vPBIXFiles) DestinationFolderPath: $($vDestinationFolderPath)<-------------------------"
Write-Host "------------------------->DestinationFolderPath: $($vDestinationFolderPath)<-------------------------"
Write-Host "------------------------->PBIXFiles: $($vPBIXFiles)<-------------------------"
try
{


Write-Host "------------------------->Started Uploading file: $vPBIXFiles to destination path: $vDestinationFolderPath on report server $vReportServerURI<-------------------------"
Write-RsRestCatalogItem -WebSession $session -Path "$($vSourceFolderPath)$($vPBIXFiles)" -RsFolder $vDestinationFolderPath -Description $vDescription -Overwrite
Write-Host "------------------------->Completed Uploading file: $vPBIXFiles to destination path: $vDestinationFolderPath on report server $vReportServerURI<-------------------------"

}
catch
{
Write-Warning "Failed to upload the file: $vPBIXFiles to report server $vReportServerURI"
Return
}
}

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Import-Module ReportingServicesTools

$vReportServerURI = 'http://Server/Reports/'
$vRSRootFolderName = '/ABC' # /=Home and /Folder1=Folder1
$vRSFolderName = 'YYY'
$vSourceFolderPath = 'C:\MyFolder\PowerShellSource\'
$vDescription = "Deployed Power BI Report Using PowerShell"

$vDestinationFolderPath = $vRSRootFolderName +"/"+ $vRSFolderName
$vSourcePBIXFiles = Get-ChildItem -Path $vSourceFolderPath -Filter *.pbix -Recurse

$session = New-RsRestSession -ReportPortalUri $vReportServerURI

#Create Destination Folder On Power BI Report Server
try
{
New-RsRestFolder -WebSession $session -RsFolder $vRSRootFolderName -FolderName $vRSFolderName -ErrorAction Stop
Write-Host "------------------------->Created folder: $($vRSRootFolderName)/$($vRSFolderName)<-------------------------"
}

catch
{
Write-Host "------------------------->Folder: $($vRSRootFolderName)/$($vRSFolderName) exists<-------------------------"
}

 

#Upload Copy of PBIX to Destination Folder On Power BI Report Server
foreach ($vPBIXFiles in $vSourcePBIXFiles)
{

Write-Host "------------------------->SourceFilePath: $($vSourceFolderPath)$($vPBIXFiles) DestinationFolderPath: $($vDestinationFolderPath)<-------------------------"
Write-Host "------------------------->DestinationFolderPath: $($vDestinationFolderPath)<-------------------------"
Write-Host "------------------------->PBIXFiles: $($vPBIXFiles)<-------------------------"
try
{


Write-Host "------------------------->Started Uploading file: $vPBIXFiles to destination path: $vDestinationFolderPath on report server $vReportServerURI<-------------------------"
Write-RsRestCatalogItem -WebSession $session -Path "$($vSourceFolderPath)$($vPBIXFiles)" -RsFolder $vDestinationFolderPath -Description $vDescription -Overwrite
Write-Host "------------------------->Completed Uploading file: $vPBIXFiles to destination path: $vDestinationFolderPath on report server $vReportServerURI<-------------------------"

}
catch
{
Write-Warning "Failed to upload the file: $vPBIXFiles to report server $vReportServerURI"
Return
}
}

Anonymous
Not applicable
DavisBI
Solution Specialist
Solution Specialist

Hi @Anonymous ,

 

You can only upload .pbix to Power BI Report Server instead of SQL Server Reporting Services.

If you want to upload all report at once, you can use REST API (refer to this)

 

Best!

 

Mark this answer as solutin if this helps,thanks!

Anonymous
Not applicable

I am getting error when try to run this:

 

$UserName1='domain\usename'
$Password1 ='password'
$folderName = 'Marketing'
$ReportServerURI = 'http://Servername/Reports/'
$folderLocation = '/'
$pbixfile = 'C:\Users\KPIs.pbix'
$description = "Deployed Using PowerShell"
$publishPBIXFileSplat = @{
ReportServerURI = $ReportServerURI
folderLocation = $folderLocation
description = $description
pbixfile = $pbixfile
folderName = $folderName
AuthenticationType = 'Windows'
ConnectionUserName = $UserName1
Secret = $Password1
Verbose = $true
}
Publish-PBIXFile @publishPBIXFileSplat

 

 

Error:

Publish-PBIXFile @publishPBIXFileSplat
Publish-PBIXFile : The term 'Publish-PBIXFile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:17 char:1
+ Publish-PBIXFile @publishPBIXFileSplat
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Publish-PBIXFile:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.