microsoft / Analysis-Services

Git repo for Analysis Services samples and community projects
MIT License
605 stars 416 forks source link

'MissingDefinitionParts' error when attempting to import PBIB report to workspace #286

Closed denialofself closed 2 months ago

denialofself commented 3 months ago

Using the sample script

# Authenticate
Set-FabricAuthToken -reset

# Ensure workspace exists
$workspaceId = New-FabricWorkspace  -name $workspaceName -skipErrorIfExists

# Import the semantic model and save the item id
$semanticModelImport = Import-FabricItem -workspaceId $workspaceId -path $pbipSemanticModelPath

# Import the report and ensure its binded to the previous imported report
$reportImport = Import-FabricItem -workspaceId $workspaceId -path $pbipReportPath -itemProperties @{"semanticModelId" = $semanticModelImport.Id}

Getting the following error with no indication of what its looking for or how to correct it

Existing items in the workspace: 2 Payload parts: part: /definition.pbism part: /diagramLayout.json part: /model.bim Creating a new item Exception: Response status code does not indicate success: 400 (Bad Request).; API error code: 'MissingDefinitionParts'

MarcChristiansen commented 2 months ago

I had a similar issue using the sample script on an ubuntu agent.

When I switched to a windows agent it worked fine.

The main difference I saw was in the part listing where ubuntu had "/" in front of every part and it did not have the ".platform" part.

Ubuntu:

Payload parts:
part: /definition.pbism
part: /diagramLayout.json
part: /model.bim
Creating a new item
Exception: Response status code does not indicate success: 400 (Bad Request).; API error
code: 'MissingDefinitionParts'

Windows:

Payload parts:
part: .platform
part: definition.pbism
part: diagramLayout.json
part: model.bim
...
Success
Jtho28 commented 2 months ago

I have discovered that this is an issue with $partPath = $filePath.Replace($itemPathAbs, "").TrimStart("\").Replace("\", "/") in FabricPS-PBIP.psm1. I've made a change to detect the OS and trim ("/") instead on unix systems.

RuiRomano commented 2 months ago

Thanks! Will look into your PR.