Forum Discussion
Can we deploy Power BI Report to workspace using Azure Pipelines using Service Principal without Pro
Hi,
Please suggest if there is any way to deploy Power BI Reports to workspaces in Power BI Service using Service Principalre using Azure Pipeline and without having a Power BI Pro license ? Could you suggest some references?
Thank you.
6 Replies
- Sahir_Maharaj
Super User
Hello pavanmanideep,
To deploy without a Pro license, the target workspace must be backed by Power BI Premium Capacity. The Service Principal should also be assigned the Contributor or Admin role on the workspace.
You can use Invoke-RestMethod in PowerShell (or custom scripts) within your pipeline to interact with the Power BI REST API.
1. Get an authentication token for the Service Principal
$token = (Invoke-RestMethod -Uri "https://login.microsoftonline.com/{TenantId}/oauth2/v2.0/token" ` -Method POST ` -ContentType "application/x-www-form-urlencoded" ` -Body @{ grant_type="client_credentials"; client_id="{Your-Service-Principal-ClientId}"; client_secret="{Your-Service-Principal-Secret}"; scope="https://analysis.windows.net/powerbi/api/.default" }).access_token2. Use the Power BI REST API to upload a report
$workspaceId = "{Workspace-ID}" $filePath = "path-to-your-report.pbix" $fileContent = [System.IO.File]::ReadAllBytes($filePath) Invoke-RestMethod -Uri "https://api.powerbi.com/v1.0/myorg/groups/$workspaceId/imports" ` -Method POST ` -Headers @{Authorization = "Bearer $token"} ` -ContentType "multipart/form-data" ` -Body @{ "datasetDisplayName" = "ReportName"; "file" = $fileContent }Hope this helps.
- pavanmanideep
Helper III
Thank you Sahir_Maharaj for your reply, my client has 30 Power BI Pro Licenses. The reports are being developed by Pro users who are having Admin access and deploying from Power BI Desktop to workspace till now.
The same should be automated using Azure DevOps Pipeline, in this case, we should create a Service Principal, give delegated access to Power BI API's and assign a Power BI Pro license to Service Principal created.
Please suggest if my understanding is correct.
Thank you.
Cheers,
PMDY
- AnonymousNot applicable
Yes, your understanding is basically correct.
The following diagram illustrates the end-to-end scenario with two development workflows:
Here are some links for your refrence:
How to Automate and Customize Power BI Deployments with CI/CD Pipelines | phDataAzure DevOps build pipeline integration with Power BI Desktop projects - Power BI | Microsoft Learn
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.