Git Integration With Power BI. Everything You Need to Know

Spread the love

In my previous post, I talked about the main Git terms you should know. This time, I want to go deeper and show you how to do Git integration into Power BI that could be used for version control of your Power BI files, collaboration on the same file and reverting changes (the last 2 will be discussed in the future videos or/and blog posts.

Below, you’ll find all the steps for this integration, but more descriptions and tutorial can be found in the video (press the link or scroll to the end of this page).

So, before starting, some work needs to be done.

Prerequisites

  1. Install Git: https://Git-scm.com/   
  2. Install Visual Studio Code (VS Code): https://code.visualstudio.com/Download – you can use something else if you want, but I’ll be working with it. 
  3. Have Azure DevOps organisation and Project dedicated to this: https://dev.azure.com/. Also, you must be able to use Repos in Azure DevOps. Again, you must create it or ask the responsible department to do it. 
  4. In Fabric tenant settings, these settings need to be enabled*: *at least the first one; others depend on company policy. Moreover, restricting it to specific security groups is preferable.
  5. You must be able to create a workspace in Power BI Service and assign a Premium/Fabric Capacity (or ask someone responsible for it to do it).
  6. Your Azure and Power BI accounts must be registered to the same user, e.g., odeta@dragonsdata.com.
  7. You need to have at least one Power BI report.
  8. Enable a preview feature “Power BI Project (.pbip) save option” in Power BI Desktop.

Setup Steps

  1. Tools installation:
    1. After installing Git, make sure that it is installed correctly. You can do that by opening Command Prompt (search for cmd) and running:
      Git –version
    2. When installing VS Code, it is useful to select these options:

  2. In Power BI Desktop (check if the Step 7 from the Prerequisites is done):
    1. Have a Power BI report on your local machine (e.g., on your laptop) in a folder** (e.g., your project folder). For example, the folder can be called “Git and PBI Integration Demo”.
      **this will be your local repository.
    2. Open the report and save it as a project (PBIP).
  3. If you’re doing this for the first time, in Command Prompt, run this:
    cd path to your folder, e.g.:
    cd C:\Users\Odeta\Desktop\PBIP Folder
    1. Git config user.name “Your Name”, e.g., Git config user.name Odeta
    2. Git config user.email “Your Email”, e.g., Git config user.email odeta@dragonsdata.com
  4. In VS Code – This is how you create a local repository
    1. Initialise the repository from VS Code (done only once per project) by right-clicking on the folder from Step 2 (“Git and PBI Integration Demo”) and choosing “Open with (VS) Code”. 
    2. Go to Source Control and 
      1. select “Initialize Repository”.
      2. Stage everything.
      3. Enter the commit message and commit.
  5. In DevOps – this is how you create a remote repository:
    1. Select the proper Organization***.
    2. Open the specific project***.
      ***these needed to be created as stated in prerequisite’s Step 3
    3. Go to Repos and create a new repository****. For example, call it “GitPBIintegrationDemo_OJ”, where OJ – initials.
      ****if you select “Add a README”, you must create a README.txt file in your project folder on your local machine.

    4. Copy the https address.
  6. In VS Code – this is how you connect your remote and local repositories:
    1. Open the source control menu
    2. Add remote (… > Remote > Add Remote…)
    3. Paste the copied https address from DevOps Repos and press Enter
    4. Enter a name for the remote repository, e.g., “GitPBIintegration_OJ_local”, and press Enter
    5. Provide your credentials when prompted
    6. Press “Publish Branch”. 
    7. Now you can see the same PBIP files in DevOps (after page refresh)
  7. In Power BI Service – this is how your Power BI files land to Power BI Service and are synced with Git:
    1. Create a dedicated workspace and assign it Premium/Fabric capacity (make sure that Step 5 from the Prerequisites is done)
    2. Setup Git integration in the Workspace Settings window:
      1. Organisation – the one from DevOps,
      2. Project – the one from DevOps,
      3. Git repository – one from DevOps (“GitPBIintegrationDemo_OJ”)
      4. Branch – main
      5. Press “Connect and sync”
      6. Refresh a dataset 

Step-by-Step Tutorial

I thought that it would be easier to show you how it’s done in this video below.


Spread the love

3 thoughts on “Git Integration With Power BI. Everything You Need to Know”

  1. Great info, thank you for sharing it. Is this feature available in Premium Per User workspaces as well?

Leave a Comment

Your email address will not be published. Required fields are marked *