Power BI developers have long sought a solution that makes collaboration, version control, and proper CI/CD possible. Enter Power BI Developer Mode, a relatively new functionality within the Power BI ecosystem that seamlessly allows for GIT integrations.
In this blog, we will explain what Power BI Developer mode does and how it can improve the job of a Power BI developer.
Why Power BI with GIT Integration is Important
Following are the advantages of saving your work as a Power BI project:
Version control: Power BI semantic models and report definitions can be stored within a version control tool such as GIT. Using GIT, developers can track the version history of semantic models/ reports, compare different versions, and revert the artifacts to previous versions.
Continuous Integration and Continuous Delivery (CI/CD): With CI/CD, when developers make changes to a PBIP file, those changes can be validated through automated testing and deployed to respective workspaces.
Support for text editing: Artifact definition files are text files in JSON format that contain metadata of semantic models and reports. These files can be edited using basic text tools like Notepad++. However, Microsoft recommends using a more advanced code editor such as Visual Studio Code for text editing as it has an improved editing environment and GIT integration.
How to Enable Power BI GIT Integration
Power BI Project Files
Introducing the initial aspect of Developer Mode, Power BI Desktop now enables users to save their work as a new file type, Power BI Project (PBIP). This functionality stores report and dataset artifact definitions as separate plain text files organized in a straightforward folder. Saving as a Power BI Project file is in Preview. To use this feature, please follow the below steps.
First, go to File > Options and settings > Options > Preview features and check the box next to Power BI Project (.pbip) save option.
Using Power BI Desktop, open a PBIX file and select File > Save As. On the Save As dialog, pick a folder in your file system and choose the file type Power BI project files (*.pbip):
When you save as a project, Power BI Desktop saves report and dataset artifacts as folders, each containing text files that define the artifact. You see the following:
Let’s dive into the components of your project’s root folder:
<project name>.Dataset: This folder is a collection of files and folders representing a Power BI dataset. It encompasses crucial files such as
model.bim
.<project name>.Report: in this folder, you will find files representing the Power BI report. The primary file of significance here is
report.json
, although external modifications to this file are not supported during the current Public Preview of this functionality.<project name>.PBIP: this file serves as a pointer to a report folder. Opening a PBIP file directs you to the targeted report and model for authoring.
.GITIgnore: this file specifies files intentionally left untracked by GIT, ensuring that only metadata is stored in the GIT repository. Data is stored locally as a cached copy named
cache.abf
, which tends to be a large binary file and is consequently ignored by GIT.
In contrast to the PBIX, within the Power BI Project, the report and semantic model are separate and self-contained. This mirrors the Power BI Service structure, where publishing a PBIX file generates two items in a Workspace. The report maintains a connection to the dataset through the definition. The pbir file is located in the report folder.
Source Control with GIT
The main objective of a Power BI project is to enable source control by preserving your Power BI Desktop development as folders and text files. GIT proves to be an excellent option for achieving this objective. Since Power BI Desktop lacks native GIT integration, you must use an external tool such as Visual Studio Code (VSCode) to initialize your GIT repository.
Create a local GIT repo by opening the Power BI Project folder using VSCode:
Click on the Source Control option and select Initialize Repository:
Open Azure DevOps Project > Select Repos > Under the Selected Repository, select Clone.
Copy the HTTPS Command-line URL
Click the ellipsis (3 dots) > Remote > Add Remote in Visual Studio code. Paste the copied URL and click on enter.
Provide a name for your repository and click on enter.
Select main and choose the Remote branch, which we added in the previous step.
Stage all the changes, provide the commit message, and click on Commit.
Click on Sync Changes to pull and push commits from and to Azure-GIT-Repo/main.
All the files are now synced to Azure GIT Repository.
Synching artifacts to Power BI Workspace
Open your workspace, click the ellipsis (3 dots), and select Workspace Settings.
Under GIT Integration, choose Organization name, Project name, GIT Repository, Branch name, and GIT folder name (optional), then click Connect and sync.
After clicking on Connect and sync, content from GIT automatically starts syncing into the workspace and gets synced.
Whenever we change the report/dataset, we can compare the changes between the older and new versions in Visual Studio. Later, a newer version can be committed and synced with Azure GIT Repo. In this example, I removed one KPI card.
After the new changes are pushed into Azure GIT Repo, we see a Power BI Service notification: “You have pending changes from GIT. We recommend you update the incoming changes and then continue working.” You can click on the Source control option and update all the latest changes from Azure GIT Repo by clicking Update all.
GIT synching is bidirectional, i.e., any changes made to the report/dataset in Power BI Service can be committed to the Azure GIT Repo, too. After making reporting changes in the workspace, save the report (In this example, I removed the dataset’s KPI card by editing the report in the workspace). Select the Source control option, select the artifacts to be committed, write the commit message, and click on Commit to sync the latest changes made in the workspace to Azure GIT Repo.
To sync the changes from Azure GIT Repo to your local folder, open Visual Studio Code, click on ellipsis (3 dots), and click on Pull. The latest changes made to the report/dataset in Power BI Service will now be synced to the local folder.
Closing
The introduction of Power BI Desktop Developer Mode meets the requirements of large organizations needing collaborative teamwork and automated deployment. Power BI Developer mode enhances source control capabilities and helps streamline the Continuous Integration and Continuous Delivery (CI/CD) processes.
Bidirectional synchronization between Power BI Service and Azure GIT Repository is a revolutionary update that aids in version control and co-authoring. As Power BI continues to grow, Developer Mode is evidence of Microsoft’s dedication to empowering users with strong Power BI solutions.
Reach out to phData to fully leverage these powerful features and ensure seamless integration into your workflows. Our team of experts can provide guidance and support, helping your organization maximize the potential of Power BI Developer Mode and enhance your overall BI strategy.
FAQs
Does Power BI support version control?
Yes, Power BI supports version control through its Developer Mode. It allows users to integrate with GIT for source control, enables versioning of reports and datasets, and facilitates collaboration and change tracking efficiently.
What is the recommended tool for versioning of Power BI reports?
The recommended tool for versioning Power BI reports is Azure GIT Repo, integrated with Visual Studio Code, enabling developers to manage changes, collaborate efficiently, and maintain a history of modifications seamlessly.