Forum Discussion
Issue with Power BI API Permissions for Reports and Datasets when Generating Embed Token
- 1 year ago
Hi Anonymous .
Your issue is due to application permissions not including Report.Read.All and Dataset.Read.All, as these exist only under delegated permissions. Since you're using App-Only authentication, follow these steps:
-
Enable Service Principal Access in Power BI
- Go to Power BI Admin Portal → Tenant Settings
- Enable “Allow service principals to use Power BI APIs”. Assign a Security Group
-
Grant Workspace-Level Access: Add your Service Principal (App ID) as an Admin or Member in the Power BI Workspace
-
Use Client Credentials Flow for Authentication: Ensure your OAuth token request uses client_credentials and resource=https://analysis.windows.net/powerbi/api
-
Correct API Permissions in Azure AD
- Assign only application permissions:
- Dataset.ReadWrite.All
- Report.Read.All
- Workspace.ReadWrite.All
- Grant Admin Consent
- Assign only application permissions:
-
Generate Embed Token Using API
POST https://api.powerbi.com/v1.0/myorg/reports/{reportId}/GenerateToken Authorization: Bearer {access_token} Content-Type: application/json { "accessLevel": "View", "identities": [] }
-
Hi Anonymous .
Your issue is due to application permissions not including Report.Read.All and Dataset.Read.All, as these exist only under delegated permissions. Since you're using App-Only authentication, follow these steps:
-
Enable Service Principal Access in Power BI
- Go to Power BI Admin Portal → Tenant Settings
- Enable “Allow service principals to use Power BI APIs”. Assign a Security Group
-
Grant Workspace-Level Access: Add your Service Principal (App ID) as an Admin or Member in the Power BI Workspace
-
Use Client Credentials Flow for Authentication: Ensure your OAuth token request uses client_credentials and resource=https://analysis.windows.net/powerbi/api
-
Correct API Permissions in Azure AD
- Assign only application permissions:
- Dataset.ReadWrite.All
- Report.Read.All
- Workspace.ReadWrite.All
- Grant Admin Consent
- Assign only application permissions:
-
Generate Embed Token Using API
POST https://api.powerbi.com/v1.0/myorg/reports/{reportId}/GenerateToken Authorization: Bearer {access_token} Content-Type: application/json { "accessLevel": "View", "identities": [] }
Hi rohit1991 ,
Thank you so much for your detailed instructions! I followed your steps, and it worked perfectly. I really appreciate your help.