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.com/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.com/v1.0/myorg/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[task.complete 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.com/v1.0/myorg/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[task.complete 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.com/v1.0/myorg/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 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