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": [] }
- Waldner1 year agoNew Member
Hi rohit1991
I'm encountering a similar issue and tried following your advice.
In step 1, I see the option "Service principals can use Fabric APIs," but not "Allow service principals to use Power BI APIs."
In step 4, the application permissions only show Tenant.Read.All and Tenant.ReadWrite.All.
I'm not sure what I'm missing here. Can you help please?
Thanks!
- pguth1 year agoNew Member
Did you ever figure this out? I'm having the exact same outcome as what you describe.
Thanks,
Philip
- Anonymous1 year agoNot applicable
Hi rohit1991 ,
Thank you so much for your detailed instructions! I followed your steps, and it worked perfectly. I really appreciate your help.