CI/CD Comes to Power BI with Microsoft Fabric
Super excited about this one. WIth the recent announcement of Microsoft Fabric, Power BI now has git integration. We can now version control our reports and datasets, and use Azure DevOps to deploy them to the service. How cool is that?
Check out the doco at https://learn.microsoft.com/en-us/fabric/cicd/git-integration/intro-to-git-integration
So let’s take a look at how this works.
A Simple Report
First, let’s make a simple report. Here’s a very basic Sales Report using one of the example datasets that comes with Power BI Desktop - Financial Sample.xlsx
- which you can download from here. I’ve put this in Sharepoint and connected to it using the Sharepoint Folder connector.
Save as PBIP
PBIP - Power BI Project - is a new way for Power BI Desktop to save an expanded version of what typically lives inside a PBIX file. This is a preview feature in the Desktop June 2023 release and needs to be enabled in the Options menu.
YMMV but my Store version of Desktop was automagically updated to Version: 2.118.286.0 64-bit (June 2023) with the preview feature a few days after Build.
Once enabled, you can save (and open later) your report as a PBIP file. This is a set of folders that contains the various definitions for the dataset, report layout, theme, and any other files that are part of the report.
FYI - probs a good idea to save into a new folder.
You can see Power BI Desktop created a folder for ReportName.Dataset
and ReportName.Report
. These reflect the artefacts in of a normal PBIX - a Report and a Dataset. The Report folder contains several json files which describe the layout of the report and the various editors, plus theming and any static content added to the report (images etc).
The Dataset folder contains similar editor layout metadata, but more importantly is the model.bim
file - the TMSL model of the dataset.
Imported data is stored in the .pbi
folder in the cache.abf
file - an Analysis Services backup file which holds the behind-the-scenes AS database (You did know that Power BI is Analysis Services redux?).
Power BI Desktop kindly writes a .gitignore
to prevent cache.abf
from being checked in to source control. Pretty neat.
**/.pbi/localSettings.json
**/.pbi/cache.abf
One thing to remember though is when deploying from devops, you’ll need to set credentials and refresh the dataset in the service before your report will have anything to display. Unlike uploading a PBIX directly, the PBIP dataset is empty before this initial load.
Push It Real Good
Let push the project to devops. I’ve created a new project in Azure DevOps, added a new repo and created a dev
branch. My PBIP was saved into a folder workspace
(because that’s what we’re deploying to our workspace, duh).
Currently, only Azure DevOps is supported.
Running some magical git commands, we get
Time to hook up the Fabric Workspace.
Fabric Workspace
In the Fabric portal, open the target workspace settings and select Git integration.
Fill in the repo settings, eg. Notice the Git folder is set to the folder in my repo where the PBIP is stored.
N’Sync
Hit Conect and Sync. Wait. You’ll see a few warnings as the content is first pulled from git and finally two nice green ticks for the dataset and report.
If you open the report now, it will be empty. Head into the dataset settings and set relevant credentials for the datasource(s), then refresh the dataset (same as any other PBIX deployment really). Now open the report et voila!
Ch-ch-ch-changes
You can edit the report in the service and push changes back to git. Open the report, tweak it a bit and save. The status will change to Uncomitted.
Click the Source control button (the one with the big red warning number) and a new pane will open.
From here you can select which changed artefact to commit and push back to devops. Too easy. The service will also tell you if the workspace is out of sync with the repo, and prompt you to sync in a similar manner.
Wrapping Up
So that a first look at CI/CD in Fabric for Power BI reports and datasets. I can’t wait to see how this develops as Fabric progresses towards GA.
If you want to know more about CI/CD with Power BI, You’re Deploying it Wrong! - AS Edition is still a great place to start, and for OG .pbix CICD, check out [pbi-tools] (https://pbi.tools/) and Power BI Deployment Pipelines