Devops for Azure Power BI

Objectives

  • Power BI Plugin

  • Workflows and Topology Setup

  • Project setup for Power BI

  • Project Configuration and Packages

  • Automate check-in of Development Power BI report to SCM

  • Build the report from Source Control and Deploy to a Power BI Workspace

  • File attributes

Introduction

Power BI is a unified self-service and enterprise analytics solution that allows you to visualize your data, share insights across your organization, and embed them in your app or website. Together, Azure Analytics and Power BI provide scalable insights, helping you foster a data-driven culture essential for thriving in a fast-paced, competitive environment.

In Power BI, the two most popular report types are Reports and Semantic Models. FlexDeploy simplifies the automation of report deployment across workspaces. This blog will help you understand why FlexDeploy is an ideal choice for implementing DevOps and Continuous Delivery with Azure Power BI.

Features

·       Integrate with Power BI to export and import Reports and Semantic Models.

·       Provide support for importing embedded reports and shared semantic models.

·       Rebind a specified report to a semantic model from the same or a different workspace.

·       On Demand refresh of semantic model.

 

image-20240924-050709.png

Continuous Build, Integration, Test and Delivery

·       Leverage the source control management tool your team is already familiar with. FlexDeploy integrates with all popular source control systems, including Git, CVS, Subversion, Microsoft TFVC, and many more.

·       Use FlexDeploy workflows to create fast, repeatable, and automated processes that streamline deployments across workspaces.

Azure Power BI Plugin

The Azure Power BI plugin includes the following operations to facilitate the aforementioned features:

·       exportContents: Exports specified contents from a selected workspace to a .pbix file.

·       importContents: Imports previously exported contents into a target Power BI workspace.

·       getResourceIDs: Retrieves the IDs of semantic models and reports available in a specific workspace.

·       rebindReport: Rebinds a specified report from a selected workspace to a designated semantic model, particularly useful for shared semantic models.

·       refreshSemanticModel: Triggers an on-demand refresh of the specified semantic model from the chosen workspace.

Topology

To create a Power BI instance, we first establish a Cloud Integration and then map it to the appropriate target group. To create a Cloud Integration, navigate to the Integration section from the menu.

In Integrations, navigate to the Cloud Integrations, and create a Cloud account for Azure Power BI. Make sure to provide the required details.

image-20240924-091303.png

 

Additionally, we will need to create a service principal in Azure and configure the security group for the Admin API settings in the Power BI Admin Portal. – Specify that as pre-requisite that one must have the service principal created in Azure before configuring the cloud account.

Service Principal

To create a service principal:

  • We first need to create app registration in Microsoft Entra ID and create new secret. This secret would be used to configure the Power BI cloud account in FlexDeploy. No need to assign any permissions from Azure Portal.

 

 

  • Create a group say PowerBICICDGroup and assign the service principal created in previous step

·       We need to go the PowerBI, and in the Admin portal, assign the group to “Allow Service Principals to use Power BI APIs”. It would look similar to below:

  • Once this is done, we need to add the service principal App to the respective workspaces as Contributor, from where you will export the reports or import the reports to

How to use a service principal in Power BI Admin REST APIs in Power Automate - Forward Forever

Projects

Projects enable us to build and deploy Azure Power BI reports from one workspace to another. To create a new project, click the 'Create' button on the Projects page. This will open the project creation page, where we can enter the required details and select the Project Classification and Project Type FlexDeploy supports both Package-based as well as Full Deployment, but package based is encouraged more as with Package based, we have control over which all Files we want to deploy. Project type comes into picture when we select Package Based Project.

Choose Package-Based for the project classification and Azure Power BI for the project type.

Configurations

After creating the project, create the Target Group for Power BI, and set the Build workflow and target group on the Configuration tab.

Once we have configured these settings, go to the target group we created and specify the Workspace ID and the Power BI Cloud Account we set up earlier.

Once the build workflow and target group are configured, we will be able to discover files.

Navigate to the Package tab and click on File Catalog.

After clicking on File Catalog, select the Discover Files option. This will discover files from the Azure Power BI Workspace or SCM, if specified.

Packages

After the project is created, we will see the Package tab. Here, we will create a new package, such as Reports.

The project files serve as a repository or catalog of the objects. Files from this repository can now be added to User Managed or Dynamic Packages. We will add the reports to the package for export from the workspace. This allows us to specify which items should be included in the package for deployment.

File Attributes

Another valuable feature is the File Attributes. By clicking on a file within a package, you can access its attributes. These attributes can be used as needed during the deployment process, offering greater control and flexibility.

For instance, if we wish to change the display name of a file after importing it (to avoid duplicates), you can use the Target Display Name attribute and specify our desired name.

Similarly, if we want to skip the creation of a particular report, you can check the Skip Report checkbox. This will prevent the creation of that specific report during the deployment.

In this blog, we will demonstrate the process of Exporting report from one Power BI workspace to a Source Control, and then Deploying the reports from Source control to the intended Power BI Workspace.

Automate check-in of development Power BI report to SCM

Azure Power BI projects allow us to source reports from an intended Power BI workspace. FlexDeploy can sync files from an intended workspace to a source code repository, helping implement DevOps best practices for source control of developer code.

 

 

Build Workflow

Our goal is to export files from an intended workspace and commit them to Git with the necessary changes. This is part of the build workflow. Our workflow will do a Standard Build/Deploy from the intended workspace, with check-in to SCM for Versioning.

Now, let's discuss the ExportAndSyncToGit workflow, which consists of the following five steps:

  1. Clone the Git repository where report will be stored.

  2. Export Power BI reports into the local Git repository folder. This export is typically done from the intended workspace. The number of reports exported depends on whether the build is for All Files or a Package.

  3. Add any new files to the local Git repository.

  4. Commit any changes to the local Git repository. If there were no changes in the intended workspace, there may be nothing to commit.

  5. Push changes to the remote repository.

This will export the files from the intended Power BI Workspace to your Git Repository. 

Build the report from Source Control and Deploy to Power BI Workspace

 

Now that the Power BI report is synced to source control, it can be deployed to the Power BI workspace.

To proceed, create a package-based project and select Azure Power BI as the project type.

After creating the project, I’ve set the following configuration on the Configuration tab.

  • Build and Deploy workflows as we created.

  • Build and Deploy instances as we created in the Topology section.

 

After configuring the workflow and target group, navigate to the source control and select the Git repository where the reports were synced.

After setting the configurations, go to the Target group we created, and set the Workspace ID and the Power BI Cloud Account

That completes the project configuration.

 

Build and Deploy Package-based files

Once the packages are created, they can be built and deployed across the workspace like any other FlexDeploy project. This can be done through builds and deployments or orchestrated via an integrated toolchain pipeline. In the example below, we will demonstrate importing a .pbix report using build and deployment.

Build Project

Now that the configuration is complete, you're ready to execute builds and deployments. In the Executions tab, click on the Build button. This will bring up the Build request form.

From the form, you can select the desired package for the build.

Once the execution is complete, you can see the files and artifacts generated in the Artifacts directory.

Deployments

If you return to the main execution screen, you can submit deployment requests to deploy the project version into one or more workspaces. Click on the Deploy button at the end of the build execution, which will open the deployment request form. From there, you can select the target workspace and submit the request.

When drilling into the execution, you can view the steps of the deployment workflow. By drilling into the logs, you can review the resulting output.

If you click on the Files tab within the execution, you'll see a list of the .pbix files that were imported, along with their status.

After Deployment, we can see the imported report in the Power BI workspace

On demand Refresh of a semantic model

There are other ad-hoc operations that helps us in managing reports in Power BI workspace more efficiently.

One of the use case is if we want to refresh a semantic model in a workspace, we can use the refreshSemanticModel operation.

We can create a utility project. And use a utility workflow. While creating the project, you can choose the project classification as Utility.

This utility project will use a utility workflow.

Our workflow will look something like this.

 

Operation:

In the operation, we need to provide the either the semantic model Name or the semantic model ID which we need to refresh

Now, in the project, we will execute the project. Once the execution is complete, we can see the output In the logs, and it will provide us the refresh status.

Rebind report to a semantic model

Another useful operation is the rebindReport operation. This is useful if we need to rebind a report to a semantic Model. This can rebind the report to a semantic model to a different workspace as well.

Similar to the refreshSemanticModel operation, we will create a Utility project, rebindReport, and set the Utility workflow and Target group.

The workflow will have rebindReport operation and will look something like this.

Now we can set the Utility workflow and the Target group in the project configurations.

The Workspace set in the Target group should have the report that we will provide in the Plugin Input.

For ex: If we are executing the Project in TEST environment, and the workspace provided in the TEST environment is testWS, then the report provided in the plugin input should be present in the testWS.

After the configuration is done, we will go to Execution and execute the project. After the execution is successful, we can see that the report is successfully rebinded with the semantic model in the workspace.

Conclusion

In this blog article, we have outlined the steps to configure FlexDeploy as an automation solution for building and deploying Azure Power BI reports across various workspaces. The configuration includes a one-time setup for workflows, topology, and projects. This foundational setup prepares us to make ad-hoc requests for migrating reports from a source Azure Power BI workspace to any target workspace.

 

The following macros are not currently supported in the footer:
  • style