Power BI REST API returning 404 for dataset datasources, despite dataset and datasources existing

97 views Asked by At

I'm encountering an issue with the Power BI REST API while attempting to access datasources for a specific dataset using the endpoint https://api.powerbi.com/v1.0/myorg/admin/datasets/{datasetId}/datasources.

$reportdataSources = Get-PowerBIDataSource -DatasetId $dataSet -Scope Organization 
         $url = "https://api.powerbi.com/v1.0/myorg/datasets/$dataSet/datasources"
         $connectionDetails = Invoke-PowerBIRestMethod -Url $url -Method Get

Despite confirming the existence of both the dataset and its datasources, the API consistently returns a 404 error, with the following message:

{"error":{"code":"PowerBIEntityNotFound","pbi.error":{"code":"PowerBIEntityNotFound","parameters":{},"details":[],"exceptionCulprit":1}}}

I've verified the following:

  1. The dataset ID provided in the request exists in my Power BI environment.
  2. The dataset has associated datasources, confirmed through alternate means.
  3. My account has been assigned the role of Power Platform Administrator.

However, I'm using a Power BI free account license.

Could anyone shed light on why I might be receiving a 404 error despite the existence of the dataset and datasources? Could the type of Power BI license (in this case, a free account type) affect access to administrative endpoints?

Any insights or suggestions would be appreciated.

Reference article: https://learn.microsoft.com/en-us/rest/api/power-bi/admin/datasets-get-datasources-as-admin#code-try-0

1

There are 1 answers

1
Sam Nseir On

https://api.powerbi.com/v1.0/myorg/admin/datasets/{datasetId} is for a dataset in My workspace.

Whereas I think you are needing: https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId} is for a dataset in a workspace with {groupId}.

So you will need to know the DatasetID and the GroupID (workspace).