Skip to content

fabricps-pbip Import-FabricItem updateDefinition : 401 (Unauthorized).; API error code: 'Unauthorized' #340

@NarendraReddyDell

Description

@NarendraReddyDell

I am using following script to create 2 workspaces and publish the semantic model and report to the 2 different workspaces.

 $mdlworkspaceId = New-FabricWorkspace -name "TestPBIPModelWorkSpace" -skipErrorIfExists
$rptworkspaceId = New-FabricWorkspace -name "TestPBIPReportWorkSpace" -skipErrorIfExists

$currentPath = (Split-Path $MyInvocation.MyCommand.Definition -Parent)
$pbipSemanticModelPath = "$currentPath\TestPBIP.SemanticModel"
$pbipReportPath = "$currentPath\TestPBIP.Report"

Set-FabricAuthToken -reset
$semanticModelImport = Import-FabricItem -workspaceId $mdlworkspaceId -path $pbipSemanticModelPath
$reportImport = Import-FabricItem -workspaceId $rptworkspaceId -path $pbipReportPath -itemProperties @{"semanticModelId" = $semanticModelImport.Id }

After succesfully running above script.. i granted myself read,build,share for the semantic model and changed role to "Viewer" on workspace "TestPBIPModelWorkSpace".

If i now try to publish the report it errors out... (update of report)
If i delete the report and deploy report.. it works fine again. (creation of report)

Import-FabricItem -workspaceId $rptworkspaceId -path $pbipReportPath -itemProperties @{"semanticModelId" = $semanticModelImport.Id }

For updating a report looks like fabric APIs warrant write privileges on the semantic model/workspace.

Pls advise if any workaround for same.

Thanks,
Naren

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions