Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

rebind report with service principal by using PowerBI REST API

Hello all, 

 

I'm struggling trying to rebind report connected to dataset (livequery) with a service principal.

Here is the powershell code : 

 

$ApiReBindToDatasetRequestBody = @"
{
"datasetId": "$RebindDatasetId"
}
"@

 

$ApiReBindToDatasetUrl="https://api.powerbi.com/v1.0/" + $TenantId + "/groups/" + $WorkspaceObject.Id + "/reports/" + $ReportId + "/Rebind"

Invoke-PowerBIRestMethod -Url $ApiReBindToDatasetUrl -Method POST -Body ("$ApiReBindToDatasetRequestBody")

 

It throws me a 404 not found.

 

the code works perfectly fine with an identified user.

 

Prior to this code, these are the following steps :

- Publish report connected live to one dataset

- Take owner of the second dataset (the service principal has been added to the workspace where the second dataset is)

- Update parameter and link to gatewat the second dataset.

- Rebind API call to 'connect' the report to the second dataset.

The last step doesnt work with a service principal although i've added all possible permissions on Azure.

 

Help please (i've trying also to delete the report with the service principal and no success, it seems like the service principal cannot interact with the report maybe only datasets)

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    You can refer to the link below to find a suitable method to solve your problem .

    https://docs.microsoft.com/en-us/rest/api/power-bi/datasets

     

    Best Regards

    Community Support Team _ Ailsa Tao

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.