Forum Discussion
Issue with Power BI API Permissions for Datasets - 401 Unauthorized "PowerBINotAuthorizedException"
- 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 APIExplicitly 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.
Hi Xiaolingwh ,
We’d like to follow up regarding the recent concern. Kindly confirm whether the issue has been resolved, or if further assistance is still required. We are available to support you and are committed to helping you reach a resolution.
Thank you.