admin管理员组

文章数量:1426943

I am trying to find how to automatically deploy PBI Datamodels to a Workspace in PBI Service while maintaining CI/CD. I found this three pages tutorial and I have tried to replicate it .html

I do not have a Premium Workspace so I have tried to adapt the solution in order to avoid working with the PBI Deployment Pipelines, and also to avoid using more than one environment since it's not needed.

When running the pipeline, I get an error related to the PBI licensing on the step where it takes the .bim file and tries to deploy it to the PBI Service Workspace (Third post, DeployPBIModelDev.yml section, forth bit of code [# 4 Publish data models], line 26):

Publishing model [Model Farmacia 2800332 copy pipeline] in [aiPharma Models]

Tabular Editor 2.25.0 (build 2.25.8952.22276) -------------------------------- Loading model... Deploying...

##[error]Deployment failed! PowerBI Request Failed.

Action: Generating MWC token

Description: {"error":{"code":"PowerBINotLicensedException","pbi.error":{"code":"PowerBINotLicensedException","parameters":{},"details":[],"exceptionCulprit":1}}}

But as far as I understand, it is not possible to assign a PBI (Pro) License to a Service Principal.

What could be missing?

Edit:

In case I wasn't precise enough: what I am trying to do is to deploy a .bim file into a Pro workspace using the API using a Service Principal. From my understanding, there shouldn't be a use of a Premium feature on those steps.

I have also tried calling the API using Powershell in two different ways, but I get the same error:

Deploy option 1

PS C:\WINDOWS\system32> D:\Downloads\TabularEditor.Portable\TabularEditor.exe "D:\Downloads\Model.bim" -D "Provider=MSOLAP;Data Source=powerbi://api.powerbi/v1.0/my/WorkspaceModels;User ID=app:[ClientID]@[TenantID];Password=[SecretID];" "Model Name" -O -C -R -M -E -V

Return

Tabular Editor 2.25.0 (build 2.25.8952.22276) -------------------------------- Loading model... Deploying... ##vso[task.logissue type=error;]Deployment failed! PowerBI Request Failed.

Action: Generating MWC token

Description: {"error":{"code":"PowerBINotLicensedException","pbi.error":{"code":"PowerBINotLicensedException","parameters":{},"details":[],"exceptionCulprit":1}}}

Technical Details: RootActivityId: 48e5a1d2-xxxx-xxxx-xxxx-xxxxxxxxxxx ##vso[taskplete result=Failed;]Done.

Deploy option 1

PS C:\WINDOWS\system32> Start-Process D:\Downloads\TabularEditor.Portable\TabularEditor.exe -Wait -ArgumentList '"D:\Downloads\Model.bim" -D "Provider=MSOLAP;Data Source=powerbi://api.powerbi/v1.0/my/WorkspaceModels;User ID=app:[ClientID]@[TenantID];Password=[SecretID];" "Model Name" -O -C -P -V -E'

Return

Tabular Editor 2.25.0 (build 2.25.8952.22276) -------------------------------- Loading model... Deploying... ##vso[task.logissue type=error;]Deployment failed! PowerBI Request Failed.

Action: Generating MWC token

Description: {"error":{"code":"PowerBINotLicensedException","pbi.error":{"code":"PowerBINotLicensedException","parameters":{},"details":[],"exceptionCulprit":1}}}

Technical Details: RootActivityId: e87093d1-xxxx-xxxx-xxxx-xxxxxxxxxxx ##vso[taskplete result=Failed;]Done.

Deploy option 3

Based on the following structure ($headers containing the .bim file in Base64 format and the access token)

Invoke-RestMethod -Method Post -ContentType "application/x-www-form-urlencoded" -Headers $headers -Uri ".0/my/groups/4f920461-xxxx-xxxx-xxxx-xxxxxxxxxxxx/models"

Return

Invoke-RestMethod : The remote server returned an error: (404) Not Found.
At line:1 char:1
+ Invoke-RestMethod -Method Post -ContentType "application/x-www-form-u ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

I am trying to find how to automatically deploy PBI Datamodels to a Workspace in PBI Service while maintaining CI/CD. I found this three pages tutorial and I have tried to replicate it https://microsoft-bitools.blogspot/2023/01/deploy-power-bi-dataset-via-devops-setup.html

I do not have a Premium Workspace so I have tried to adapt the solution in order to avoid working with the PBI Deployment Pipelines, and also to avoid using more than one environment since it's not needed.

When running the pipeline, I get an error related to the PBI licensing on the step where it takes the .bim file and tries to deploy it to the PBI Service Workspace (Third post, DeployPBIModelDev.yml section, forth bit of code [# 4 Publish data models], line 26):

Publishing model [Model Farmacia 2800332 copy pipeline] in [aiPharma Models]

Tabular Editor 2.25.0 (build 2.25.8952.22276) -------------------------------- Loading model... Deploying...

##[error]Deployment failed! PowerBI Request Failed.

Action: Generating MWC token

Description: {"error":{"code":"PowerBINotLicensedException","pbi.error":{"code":"PowerBINotLicensedException","parameters":{},"details":[],"exceptionCulprit":1}}}

But as far as I understand, it is not possible to assign a PBI (Pro) License to a Service Principal.

What could be missing?

Edit:

In case I wasn't precise enough: what I am trying to do is to deploy a .bim file into a Pro workspace using the API using a Service Principal. From my understanding, there shouldn't be a use of a Premium feature on those steps.

I have also tried calling the API using Powershell in two different ways, but I get the same error:

Deploy option 1

PS C:\WINDOWS\system32> D:\Downloads\TabularEditor.Portable\TabularEditor.exe "D:\Downloads\Model.bim" -D "Provider=MSOLAP;Data Source=powerbi://api.powerbi/v1.0/my/WorkspaceModels;User ID=app:[ClientID]@[TenantID];Password=[SecretID];" "Model Name" -O -C -R -M -E -V

Return

Tabular Editor 2.25.0 (build 2.25.8952.22276) -------------------------------- Loading model... Deploying... ##vso[task.logissue type=error;]Deployment failed! PowerBI Request Failed.

Action: Generating MWC token

Description: {"error":{"code":"PowerBINotLicensedException","pbi.error":{"code":"PowerBINotLicensedException","parameters":{},"details":[],"exceptionCulprit":1}}}

Technical Details: RootActivityId: 48e5a1d2-xxxx-xxxx-xxxx-xxxxxxxxxxx ##vso[taskplete result=Failed;]Done.

Deploy option 1

PS C:\WINDOWS\system32> Start-Process D:\Downloads\TabularEditor.Portable\TabularEditor.exe -Wait -ArgumentList '"D:\Downloads\Model.bim" -D "Provider=MSOLAP;Data Source=powerbi://api.powerbi/v1.0/my/WorkspaceModels;User ID=app:[ClientID]@[TenantID];Password=[SecretID];" "Model Name" -O -C -P -V -E'

Return

Tabular Editor 2.25.0 (build 2.25.8952.22276) -------------------------------- Loading model... Deploying... ##vso[task.logissue type=error;]Deployment failed! PowerBI Request Failed.

Action: Generating MWC token

Description: {"error":{"code":"PowerBINotLicensedException","pbi.error":{"code":"PowerBINotLicensedException","parameters":{},"details":[],"exceptionCulprit":1}}}

Technical Details: RootActivityId: e87093d1-xxxx-xxxx-xxxx-xxxxxxxxxxx ##vso[taskplete result=Failed;]Done.

Deploy option 3

Based on the following structure ($headers containing the .bim file in Base64 format and the access token)

Invoke-RestMethod -Method Post -ContentType "application/x-www-form-urlencoded" -Headers $headers -Uri "http://api.powerbi/v1.0/my/groups/4f920461-xxxx-xxxx-xxxx-xxxxxxxxxxxx/models"

Return

Invoke-RestMethod : The remote server returned an error: (404) Not Found.
At line:1 char:1
+ Invoke-RestMethod -Method Post -ContentType "application/x-www-form-u ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Share Improve this question edited Jan 13 at 17:42 Sergikito asked Dec 12, 2024 at 17:59 SergikitoSergikito 358 bronze badges 3
  • Yes it is not possible to assign a license to a Service Principal, Will update an answer to resolve the error – Rukmini Commented Dec 13, 2024 at 3:34
  • Check this community.fabric.microsoft/t5/Developer/… – Rukmini Commented Dec 13, 2024 at 5:16
  • Hello @Rukmini ! I edited the original question in case it might get some attention back, clarifying the original idea and some of the tests I have tried since. Thank you! – Sergikito Commented Jan 13 at 17:44
Add a comment  | 

2 Answers 2

Reset to default 0

Note that: It is not possible to assign license to Service principal and Service principals are not supported in Power BI Premium Per User (PPU) workspaces. Refer this MsDoc

  • Service principals cannot be used for publishing datasets to PPU workspaces. If the workspace you are deploying to is in PPU mode, it will not allow a service principal to interact with it, hence the error "PowerBINotLicensedException"
  • Power BI Pro Mode supports service principals, but PPU does not.

Hence to resolve the error, check the below:

  • Upgrade the Workspace to Power BI Premium.
  • If you want Service Principal authentication only, then make sure that the workspace is in a Premium capacity.
  • Use a Power BI Pro User Account for Authentication and Assign a Power BI Pro License to a User in Your Organization.

Select your workspace -> Workspace settings -> Switch to Pro

Reference:

Solved: Re: PowerBINotLicensedException - Service Principa... - Microsoft Fabric Community by v-yiruan-msft.

I finally found out that, despite what the tutorial said, any kind of solution that tries to publish a .bim file needs an XMLA endpoint. Which means, you cannot do it without a Power BI Premium or PPU Workspace

本文标签: