'Power BI REST API - Datasets GetDatasourcesAsAdmin 401 despite Tenant.ReadWrite.All

we have an Azure AD user who has the PowerBI Admin rights. The "scp" of the bearer token is:

"scp": "App.Read.All Capacity.ReadWrite.All Dashboard.ReadWrite.All Dataflow.ReadWrite.All Dataset.ReadWrite.All Group.Read.All Metadata.View_Any Report.ReadWrite.All StorageAccount.ReadWrite.All Tenant.ReadWrite.All Workspace.ReadWrite.All"

I need to get the Tables of a Dataset. Since there is no direct connection (when running with the .NET Sdk, the "Tables" property is always empty) I thought I could get the Datasource and connect to it.

However, when I try to do it like here: https://docs.microsoft.com/en-us/rest/api/power-bi/admin/datasets-get-datasources-as-admin

I always get a 401 when trying to get the datasource for a dataset like this:

https://api.powerbi.com/v1.0/myorg/admin/datasets/cfafbeb1-8037-4d0c-896e-a46fb27ff229/datasources

When just requesting the dataset via:

https://api.powerbi.com/v1.0/myorg/admin/datasets/cfafbeb1-8037-4d0c-896e-a46fb27ff229

it works and gets me the dataset back.

Any suggestions, why I get a 401 here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source