Forum Discussion
Can we deploy Power BI Report to workspace using Azure Pipelines using Service Principal without Pro
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_token
2. 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.
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
- Anonymous1 year agoNot 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.- pavanmanideep1 year ago
Helper III
Anonymous
Thank you for the explanation, the article giving the detailed approach but it doesnt talk about the licensing.
Could you please confirm this works with Pro license because I cant use the second approach you suggested as it gives me below error...please advise if there is a way Microsoft suggests in this scenario.
Thank you in advance.
- Anonymous1 year agoNot applicable
As far as I know, the Pro license should be sufficient.
It's worth noting that additional charges may apply for using Azure Pipeline.
Refer to this:
Azure DevOps Services Pricing | Microsoft Azure
Here are some documents that you may need:
Apps & service principals in Microsoft Entra ID - Microsoft identity platform | Microsoft Learn
Active Directory security groups | Microsoft Learn
What is Azure Pipelines? - Azure Pipelines | 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.