Power BI
Needs VotesPowershell automation to create new pbix files from templates (pbit files)
Andy on 03 Dec 2017 13:56:06
Now that we have pbit files to help create new pbix files quickly it would be great to be able to automate this process.
Perhaps we could have some Powershell commands that would allow you to pass the needed parameters and output a new pbix file.
- Comments (78)
- Merged Idea (7)
RE: Powershell automation to create new pbix files from templates (pbit files)
Also checking for updates. Anything?? Giant functionality gap preventing us from recommending/using pbi service for many client projects.
RE: Powershell automation to create new pbix files from templates (pbit files)
Badly needed to automate report deployment. Can not believe this is still not possible in 2022.
RE: Powershell automation to create new pbix files from templates (pbit files)
This should have been done long time ago to enable automated deployments. Any updates ?
RE: Powershell automation to create new pbix files from templates (pbit files)
Correction to my previous comment. The way I converted PBIX to PBIT leaves one file out of the PBIT that is generated when exporting it from Power BI. This didn't impact my test file, but when I tried it on a complicated dashboard it messed part of it up. Still saves the visualizations, filters, layouts, etc. on the report, but part of the model is lost, so things like measures don't carry over. Not a perfect method, but it's a start, and keeps me from being so worried that I'm going to totally bork something I'm working on and then have even more work to restore it. So we still need Microsoft to put in a command line version of the Export for scripting... :-/
RE: Powershell automation to create new pbix files from templates (pbit files)
Since MS seems intent on ignoring this and similar requests, I made my own script that automates the conversion from PBIX to PBIT. Turns out that both kinds of file are just simple ZIP files, with the only difference being that PBIX files contain a file within them called DataModel which contains all the data. Removing this file from the ZIP converts it to a PBIT. The below script uses the ReportingServicesTools PowerShell module from MS to download all the files from a Reports Center location (RDL, PBIX and others), uses 7Zip to remove the DataModel files from the PBIX files, renames all PBIX to PBIT, then copies everything to the source control location. Enjoy!# ---Prerequisites--- #
#
#Must enable code execution:
#Set-ExecutionPolicy unrestricted
#
#Needs the following module installed from MS:
#Install-Module -Name ReportingServicesTools
$downloadFolder = "C:\Temp\Backup\ReportsCenter"
$projectFolder = "C:\Projects"
Remove-Item -Path $downloadFolder -recurse -force
New-Item -Path $downloadFolder -ItemType "directory"
$restSession = New-RsRestSession -ReportPortalUri http://ReportCenterURL -RestApiVersion v1.0
Out-RsRestFolderContent -RsFolder "/" -Destination $downloadFolder -WebSession $restSession -RestApiVersion v1.0 -Recurse
if (-not (test-path "$env:C:\Program Files\7-Zip\7z.exe")) {throw "$env:Program Files\7-Zip\7z.exe needed"}
set-alias sevenzip "$env:ProgramFiles\7-Zip\7z.exe"
foreach ($file in Get-ChildItem $downloadFolder\*.pbix -recurse)
{
sevenzip d -tzip $file datamodel
$newFile = ([String]$File).Replace('.pbix','.pbit')
Rename-Item -Path $file -NewName $newFile
}
Copy-Item -Path $downloadFolder -Destination $projectFolder -Force -Recurse
RE: Powershell automation to create new pbix files from templates (pbit files)
This feature would allow us to finally build a code review in our source control DevOps process because PBIT files can be decompressed into READABLE content.
RE: Powershell automation to create new pbix files from templates (pbit files)
It's almost 2022. Can we have a solution for version control please? Seriously?
RE: Powershell automation to create new pbix files from templates (pbit files)
The problem with the ideas forum is that there are multiple requests for the same thing with slightly different wording, so this specific version of this request only has 109 votes over 5 years.
The DevOps where I am currently contracted has a size limit of 18MB per file, and the pbix goes over this.
Our solution is the clear the data before publishing. A better solution would be to generate a small test database with for dev and test, which personally I am fan of (over the pbit publish), but I am a consultant, not a business decision maker, and therefore I can only advise my client and not tell them how to spend their money. Like many businesses, they don't want to go through that pain and expense (yet) so we are currently stuck with clearing the data and crossing fingers that the size is small enough.
On a separate note though, if a pbit was pushed then the file comparison would work straight out of DevOps, so we wouldn't need to use ALM for peer review. No help for connect live reports but definitely a bonus for the dataset updates.
RE: Powershell automation to create new pbix files from templates (pbit files)
It has been 4 years since this idea was posted.
Bear in mind that Amazon Quicksight already has this feature. Pretty much baked into the foundations - not an after thought.
Read this
https://aws.amazon.com/blogs/big-data/migrate-amazon-quicksight-across-aws-accounts/
RE: Powershell automation to create new pbix files from templates (pbit files)
It is impossible to implement a clean CI/CD solution without this capability. As of today, the only option is to manually convert the PBIT to PBIX and save the file to GIT. This is a security nightmare!