Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi, 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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @nsoeth ,
According to the test, no matter whether you add the /datasources to the REST API URL, it will run successfully as well. And the difference is you will get metadata of this dataset if you don’t add /datasources. Conversely, you will get datasource info of the dataset if /datasources has been added to the URL.
For the 401 Unauthorized error, it represents a client-side error, which means that the request sent was not fulfilled due to lack of authentication credentials required by the target resource. To run this REST API, you need these permissions and required scope.
For you have required scope and administrator rights, and you could run this API when removing /datasource. This issue should not be caused by permissions, it’s more caused by the configurations of your app and the code in it. You can consider restart your app and try again and check the configuration and code.
Best Regards,
Community Support Team _ Caiyun