Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Power BI Playground - report embed

Hi,

 

Can you help me about generation of AAD token for report embediing in EDIT mode.

 

Regards,

 

Ashvini Dure

  • Hi Anonymous you could generate an AAD token by registering an Azure AD app with Report.ReadWrite.All permissions. Authenticate via OAuth 2.0 to get an access token from Azure AD. Use this token as a bearer token in your embed configuration to enable edit mode

  • Hi Anonymous 


    Welcome to the Microsoft Fabric Forum. Also, thank you Akash_Varuna for your quick response.

    To embed a Power BI report in Edit mode using Power BI Playground or a custom app, you need to generate an Azure Active Directory (AAD) token using a registered Azure AD application that has the Power BI API permissions (Dataset.ReadWrite.All) granted with admin consent.

    The app must use a delegated flow, meaning the AAD token must represent a real Power BI user who has edit permissions on the report. After registering the app in Azure AD, create a client secret, and use the OAuth 2.0 authorization code flow to obtain an AAD access token with the required scopes.

    This token is then used to call the Power BI REST API's /GenerateToken endpoint with "accessLevel": "Edit" in the body to obtain an embed token. This embed token enables the report to be embedded in edit mode within a web app or Power BI Playground. Ensure that the workspace where the report resides is backed by a Power BI Pro or Fabric capacity (F64 or higher).

    For reference : What is the Power BI embedded analytics playground - Power BI | Microsoft Learn
    Embed Token - Generate Token - REST API (Power BI Power BI REST APIs) | Microsoft Learn
    Embed content in your Power BI embedded analytics application - Power BI | Microsoft Learn

    If this information helps resolve your issue, kindly consider marking this response as the Accepted Solution, as it may assist other community members facing similar challenges.

    Thank You!
     

  • Hi Anonymous 


    The 403 error on the clusterdetails endpoint typically means the AAD token lacks the necessary delegated permissions or doesn't represent a valid Power BI user. This endpoint is used internally by Power BI during embedding to locate the correct service cluster.
     

    To fix this, ensure you are using an AAD token obtained via the OAuth 2.0 authorization code flow, representing a real Power BI Pro user with edit access to the report. The Azure AD app must have the Dataset.ReadWrite.All delegated permission with admin consent granted, and the token scope should be set to https://analysis.windows.net/powerbi/api/.default.
     
    Avoid calling the clusterdetails endpoint directly; instead, use the standard /GenerateToken API for embedding. If issues persist, inspect the token via jwt.ms to verify user identity and scopes.

    If this post helps, kindly mark it as Accepted Solution.

    Thank You!

6 Replies

  • Hi Anonymous you could generate an AAD token by registering an Azure AD app with Report.ReadWrite.All permissions. Authenticate via OAuth 2.0 to get an access token from Azure AD. Use this token as a bearer token in your embed configuration to enable edit mode

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi Anonymous 


    Welcome to the Microsoft Fabric Forum. Also, thank you Akash_Varuna for your quick response.

    To embed a Power BI report in Edit mode using Power BI Playground or a custom app, you need to generate an Azure Active Directory (AAD) token using a registered Azure AD application that has the Power BI API permissions (Dataset.ReadWrite.All) granted with admin consent.

    The app must use a delegated flow, meaning the AAD token must represent a real Power BI user who has edit permissions on the report. After registering the app in Azure AD, create a client secret, and use the OAuth 2.0 authorization code flow to obtain an AAD access token with the required scopes.

    This token is then used to call the Power BI REST API's /GenerateToken endpoint with "accessLevel": "Edit" in the body to obtain an embed token. This embed token enables the report to be embedded in edit mode within a web app or Power BI Playground. Ensure that the workspace where the report resides is backed by a Power BI Pro or Fabric capacity (F64 or higher).

    For reference : What is the Power BI embedded analytics playground - Power BI | Microsoft Learn
    Embed Token - Generate Token - REST API (Power BI Power BI REST APIs) | Microsoft Learn
    Embed content in your Power BI embedded analytics application - Power BI | Microsoft Learn

    If this information helps resolve your issue, kindly consider marking this response as the Accepted Solution, as it may assist other community members facing similar challenges.

    Thank You!
     

      • v-karpurapud's avatar
        v-karpurapud
        Community Support

        Hi Anonymous 


        The 403 error on the clusterdetails endpoint typically means the AAD token lacks the necessary delegated permissions or doesn't represent a valid Power BI user. This endpoint is used internally by Power BI during embedding to locate the correct service cluster.
         

        To fix this, ensure you are using an AAD token obtained via the OAuth 2.0 authorization code flow, representing a real Power BI Pro user with edit access to the report. The Azure AD app must have the Dataset.ReadWrite.All delegated permission with admin consent granted, and the token scope should be set to https://analysis.windows.net/powerbi/api/.default.
         
        Avoid calling the clusterdetails endpoint directly; instead, use the standard /GenerateToken API for embedding. If issues persist, inspect the token via jwt.ms to verify user identity and scopes.

        If this post helps, kindly mark it as Accepted Solution.

        Thank You!

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi Anonymous 

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi v-karpurapud , we successfully made chnages as you said still we are getting 403 error for clusterdetails API. I have decoded token in jwt.ms as well. 

    Kindly guide me