Continuous delivery of Power BI Reports with AzureDevops
In this article I would like to share my experience of implementation continuous delivery pipeline for Power BI reports.
Initial problems:
- Multiple PowerBI developers working with same feature (set of PBIX reports) in PowerBI Pro cloud.
- Absence of backup and roll-back option for Production workspace.
- Manual intervention to Production workspace
Proposal for fixing initial problems:
- Use Azure AD Application account for automated deployments
- Use AzureDevops pipelines for automated deployments
- Use pre-production workspace for testing of automated deployments
General proposal workflow:
Implementation steps:
Create Azure AD Application account and enable application account in PowerBI Admin Page
Azure Portal side: For using Azure AD service principal for communication with PowerBI, we will create new service principal in Azure
PowerBI Portal side: Enable in Admin panel access for Service Principal
Here is step-by-step manual for both sides.
Eventually you should see Service principal as workspace administrator.
Outputs from this step: Application ID, Application Name, Application Key
Script continuous delivery logic
There are 2 powershell scripts based on Microsoft power BI Cmdlets:
Retrieve-PowerBIReports.ps1 for gettings PBIX files from PowerBI workspace and
Upload-PowerBIReports.ps1 for publishing to destination workspace
For both, use ‘Application ID’ and ‘Application Key’ from step 1 outputs for input paramaters $PowerBIServiceApplicationID and $PowerBIServiceApplicationKey respectively
Outputs from this step: 2 scripts in your local repository
Setup AzureDevops pipeline for release artifact creation
Use AzureDevops pipeline to run ‘Retrieve-PowerBIReports’ and form release artifact
Use SourceWorkspaceName variable as settable at quee time.
Other variables are put in Azure KeyVault and connected via variable groups
Outputs from this step: published build artifacts - scripts and PBIX reports
Setup AzureDevops release for automated deployment
Use AzureDevops release to run ‘Upload-PowerBIReports’ and deploy PBIX reports.
DestinationWorkspaceName variable is used multiple times in stage scope to specify workspaces as environments.
ReportFileName default value is ‘All’ - to deploy all files , Accepted values: ‘All’, <one_file_name> (with extension, i.e. MeReport.pbix)
PromoteConflictAction default value is ‘CreateOrRewrite’. Accepted values: Ignore, Abort, Overwrite, CreateOrOverwrite
Other variables are put in Azure KeyVault and connected via variable groups
One stage per one PowerBI workspace