Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Power BI is a business analytics service by Microsoft. It aims to provide interactive visualizations and business intelligence capabilities with an interface simple enough for end-users to create their own reports and dashboards. Currently, there is no direct way of Implementing CICD in Power BI. Using the Publish menu from the Power BI Desktop is the easiest way to deploy/publish a report as of now. In this article, we are going to see how we can implement source control and CICD for Power BI using Azure DevOps.
There are some difficulties of publishing a Power BI Report directly from Power BI Desktop, that includes
As soon as we say the automation(CICD) the things that would come to mind be like using API / Cmdlets. Likewise,we can use Power BI Rest API / PowerBI cmdlets for automating Power BI reports.
Maik van der Gaag created a great (Azure DevOps) extension called Power BI Actions, which makes things easier to handle the CICD for Power BI. We are going to see how this extension would be helpful for us in the CICD process., This extension will be handly in most way but in sometimes we need to do some additional steps that won't support by this extension for now,so we also going to use some PowerShell Scripts.
For the demo purpose here you will see two different powerbi reports deploying in two different environments (workspace), keep this as a reference you can do use your own reports.
Dev Environment Workspace : PowerBI_CICD
Prod Environment Workspace : PowerBI_CICD_PROD
PowerBI Reports:
Dev Environment Data Sources
AdventureReports => SQL =>devenvironment.database.windows.net;devdb
Products => OData => https://services.odata.org/V3/OData/OData.svc/
Prod Environment Data Sources
AdventureReports => SQL =>prodenv.database.windows.net;proddb
Products => OData => https://services.odata.org/V3/(S(2z5tfelmekddgffwed3sq4ve))/OData/OData.svc/
The initial step here is to set up a source control version for our Power BI Reports (.pbix files). In this article, we will see on how to setup the Azure Repo as version control for our Power BI Reports. Here you can also use Version control like BitBucket,TFVC,GitHub ,SubVersion etc., instead of Azure Repo.
Commit the changes
Push the Commit
Now we had our PBI reports in the Azure Repo's. It's time to setup the CICD.Let see how we can setup the Continous Integration
Setup the CI is actually very easy, We just need to include 2 task in the Build pipeline
Copy Task to Staging Artifact
Publish Task
# Starter pipeline # Start with a minimal pipeline that you can customize to build and deploy your code. # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml trigger: - master pool: vmImage: 'ubuntu-latest' steps: - task: CopyFiles@2 displayName: 'Copy Files to: Staging Artifact' inputs: SourceFolder: Reports TargetFolder: '$(Build.ArtifactStagingDirectory)' OverWrite: true - task: PublishBuildArtifacts@1 displayName: 'Publish Artifact: drop'
This release pipeline is just a demo purpose, actual release pipeline and tasks may varies depends on the various use-cases based on the end-user.So this section is just gives you a basic understanding on how you can use the existing features in azure devops to implement the Continous deployment of Power BI Reports.
The autentication for Power BI can be done in 2 ways
Kindly do remember that there are many difference between master account vs service principal autentication
As a first step you need to install this extension from marketplace (https://marketplace.visualstudio.com/items?itemName=maikvandergaag.maikvandergaag-power-bi-actions). Using Power BI Action Extension we can easily do the operations like below from Azure Pipeline,
As of now this extension is using the legacy approach of autentication using username and password, if you want to use the Service Principal you need to use your own powershell scripting which you can see in the next section.
For this demo we are planning to implement the CD for 2 Environments 1. Dev and 2. PROD
After adding the Power BI Action Task into our Release Task, we need to configure the Power BI Service connection, as this is using master account approach, we need to provide username,password and clientid
For the Production Environment we need to deploy the reports as well as need to change the datasources.
Deploy Reports
Update SQL DataSource
Update Odata DataSource
With this you can able to deploy the reports and update the datasource, but the restriction is you couldn't able to update the credentials for the updated datasource
The following features are not yet supported by this extension, but we can expect this to include in near future.
Using Powershell scripts we can do all the possible deployments and break the limitations of the Power BI Action Extension.
Here we are not going to see all the possbile actions from Power BI instead we will see how we can use Powershell script to overcome the limitations of the above extension
You can download the full script from https://gallery.technet.microsoft.com/AzureDevOps-CICD-for-fefd58b8
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.