microsoft / microsoft/powerbi-powershell
PowerBIModelNotFoundException when publishing Power BI report to Azure Power BI
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 413
- Forks
- 134
- Avg merge
- 33m
- Merged PRs (30d)
- 1
Description
We are using "MicrosoftPowerBIMgmt" module in our PowerShell scripts, specifically "New-PowerBIReport" cmdlt, to publish Power BI reports (.pbix) to Azure Power BI but getting this error message:
Bad Request (400): {"error":{"code":"PowerBIModelNotFoundException","pbi.error":{"code":"PowerBIModelNotFoundException","parameters":{},"details":[],"exceptionCulprit":1}}}
Steps to reproduce:
- Download a Power BI report (.pbix) from one Azure Power BI workspace with the option to download "A copy of your report with a live connection to data online (.pbix)"
- Use the following command to publish the report to another Azure Power BI workspace:
New-PowerBIReport -Path $pbixFilePath `
-Name $reportName `
-WorkspaceId $workspaceId `
-ConflictAction CreateOrOverwrite `
-ErrorAction SilentlyContinue
- Get this error message:
Response : Bad Request (400): {"error":{"code":"PowerBIModelNotFoundException","pbi.error":{"code":"PowerBIModelNotFoundException","parameters":{},"details":[],"exceptionCulprit":1}}}
PowerBIErrorInfo : PowerBIModelNotFoundException
RequestId : 1e56***-****-****-****-*********
ResponseDate : Fri, 09 May 2025 14:45:18 GMT
RequestMethod : POST
RequestUri : https://api.powerbi.com/v1.0/myorg/groups/***/imports?datasetDisplayName=REO&nameConflict=CreateOrOverwrite
Exception : Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'BadRequest'
at Microsoft.PowerBI.Api.V2.Imports.<UploadFile>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.Api.V2.Imports.<PostImportFileWithHttpMessage>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.Api.V2.ImportsExtensions.PostImportWithFileInGroup(IImports operations,
String groupId, Stream fileStream, String datasetDisplayName, String nameConflict, Nullable`1
skipReport)
at Microsoft.PowerBI.Common.Api.Reports.ReportsClient.PostImportForWorkspace(Guid workspaceId,
String datasetDisplayName, String filePath, ImportConflictHandlerModeEnum nameConflict)
at Microsoft.PowerBI.Common.Api.Reports.ReportsClient.PostReportForWorkspace(Guid workspaceId,
String reportName, String filePath, ImportConflictHandlerModeEnum nameConflict, Int32 timeout)
at Microsoft.PowerBI.Commands.Reports.NewPowerBIReport.ExecuteCmdlet()
at Microsoft.PowerBI.Commands.Common.PowerBICmdlet.ProcessRecord()
InnerException : False
We have a semantic model (dataset) already uploaded to the Azure Power BI workspace with correct relationships, so we expect to upload successfully our report with a live connection to data online (.pbix) without containing a semantic model (dataset) in the report file. This works properly when we publish the report using Power BI Desktop, but it doesn't work using "MicrosoftPowerBIMgmt" module.
Please provide any suggestions.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the live-connected .pbix upload with New-PowerBIReport and compare its request with the Power BI Desktop workflow. Review the POST /v1.0/myorg/groups/{groupId}/imports request and the PowerBIModelNotFoundException response; done means establishing whether this import path supports a report without its semantic model and documenting or addressing the discrepancy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100