Forum Discussion
Operation returned an invalid status code 'Forbidden'
- 1 year ago
Sorry for the late reply.
Creating new App Registration resolved the issue
Thank you!
Hi juwonp ,
Thanks for posting in the Microsoft Fabric Community.
Facing "Operation returned an invalid status code 'Forbidden'" error when calling GenerateTokenAsync() in your Power BI embedding application often points to permission or configuration issues.
A similar case was discussed in the community, where the problem was resolved by adjusting specific settings.
Solved: Operation returned an invalid status code 'Forbidd... - Microsoft Fabric Community
Ensure that "Embed content in apps" is enabled in the Power BI Admin Portal under Tenant settings, and that your service principal is part of an allowed security group.
If the issue persists despite correct permissions, try recreating the service principal in Azure, as some users have resolved issues this way.
The embed token’s validity depends on the Microsoft Entra (Azure AD) access token used to generate it. Always use a fresh access token before calling GenerateTokenAsync() to avoid expiration issues.
Generate an embed token in Power BI embedded analytics - Power BI | Microsoft Learn
Ensure that the required API permissions are granted with admin consent in Azure AD. Your app registration should include Power BI Service -> Application permissions, such as:
- Report.Read.All
- Dataset.Read.All
- Workspace.Read.All
Additionally, ensure that the service principal has the necessary workspace access in Power BI. Navigate to Power BI Service -> Workspaces and verify that it is added as an Admin or Member of the workspace containing the report. Without the correct role, it may not have the required permissions to generate an embed token.
For more details on authentication and API permissions, refer to:
Hope this helps. Please reach out for further assistance.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and a kudos would be appreciated.
Best Regards,
Vinay.
- juwonp1 year agoNew Member
Sorry for the late reply.
Creating new App Registration resolved the issue
Thank you!
- v-veshwara-msft1 year agoCommunity Support
Hi juwonp ,
Thanks for the update! Glad to hear that creating a new App Registration resolved the issue.If you found the provided information helpful, please consider accepting the solution, as it may assist others facing a similar issue. Please reach out if you need any further assistance.
Thank you.