Forum Discussion

Xiaolingwh's avatar
Xiaolingwh
New Member
2 months ago
Solved

Issue with Power BI API Permissions for Datasets - 401 Unauthorized "PowerBINotAuthorizedException"

I am encountering an issue accessing the endpoints for reports and datasets in the Power BI API.  I generate the access token with:              “auth_url” :   https://login.microsoftonline.com/{TE...
  • v-echaithra's avatar
    2 months ago

    Hi Xiaolingwh ,

    Thank you for reaching out to Microsoft Community.

    Since the GET datasets API is working, the authentication setup appears to be correct. The 401 Unauthorized "PowerBINotAuthorizedException" during ExecuteQueries is usually related to dataset permissions or tenant settings.

    Please verify the following:

    Ensure both tenant settings are enabled in Power BI Admin Portal:
    Service principals can use Fabric APIs
    Dataset Execute Queries REST API

    Explicitly grant the Service Principal:
    Build permission, read permission on the dataset under Manage Permissions.

    Verify the semantic model is not using unsupported scenarios such as RLS, SSO, or certain Live Connections.

    Confirm the access token audience (aud) is: https://analysis.windows.net/powerbi/api

    If tenant settings are restricted to a security group, ensure the Service Principal is added to that group and allow time for propagation.

    Also, it is expected that Dataset/Report permissions are available only as Delegated permissions in Azure AD. Most Power BI REST APIs with Service Principals rely on workspace and tenant-level authorization rather than Application API permissions.

    Hope this helps.