Setup Power BI Web App

The Power BI service (SaaS) and the Power BI Embedded service in Azure (PaaS) have APIs for embedding your dashboards and reports.
To call these Power BI APIs requires you to create a Power BI Web application.
Follow the steps below to register a new application.
  • TPC 6.0
  • TPC 5.3 and older

Prerequisites

To get started, you are required to have:

  • service principal (app-only token).
  • You need to have your own Azure Active Directory tenant setup.

Follow the steps below to register a new application using a Service Principal to authenticate.

  1. Navigate to https://portal.azure.com/ and sign in.
  2. Under Azure Active Directory > App registrations, click “New Registration”.
  3. Specify any Application Name and select a Supported account type, which determines who can use the application.

  4. Register App

  5. On the left panel, click “API Permissions
    1. Click “Add a permission”.
    2. On the right panel, select Power BI Service.
    3. Select “Delegated Permissions
    4. Check the following boxes:

    5. Add Permissions

    6. Click on “Add Permissions
  6. Create a Client Secret:
    1. On the left panel, select “Certificates & secrets”.
    2. Select Client secrets -> New client secret
    3. Provide a description of the secret and a duration. When done, select  Add.Client Secret
    4. Copy the secret value because you will not be able to retrieve the key later. 
  7. Save your Tenant ID for later.

    Tenant ID

  8. Create a security group on Azure AD

    1. On the Active Directory page, select  Groups and then select New group

    Security Group


    1. For “Group type” select Security
    2. Add a Group Name and Description
    3. For “Membership type” select Assigned
    4. Click on “Members” and add the Application you just created

    Security Group Members

    1. Click Create

  9. Enable service principal in the Power BI service admin settings:

    1. Navigate to https://app.powerbi.com/ and login as a Power BI admin.
    2. Under Settings > Admin Portal > Tenant Settings > Developer Settings > Allow service principals to use Power BI APIs.
    3. Set the setting to “Enabled”.
    4. Select “Specific security groups” and add the security group you created in Azure AD.

    Pbi Admin Setup


    1. Click Apply

  10. Add the service principal to your workspace

    1. Scroll to the workspace you want to enable access for, and from the  More menu, select Workspace access.

    2. Workspace Access


    3. In the Access pane, text box, add one of the following:
      1. Your service principal. The name of your service principal is the Display Name of your Azure AD app, as it appears in your Azure AD app's overview tab.
      2. The security group that includes your service principal
    4. From the drop-down menu, select Member or Admin.

    5. Select Add

  11. Workspace Access 2

Note: Make sure your account has the required permission to access the application.

Embed your content

 

To display reports in The Portal Connector using the Power BI Web app, you would need to configure the application in The Portal Connector as follows:

  1. Navigate to the Sitefinity backend
  2. Go to Administration > Settings > Advanced > PortalConnectorMvcPowerBI > Application Configurations
  3. Click Create New
  4. Fill in the App Name. It does not have to match your App Name configured previously
  5. Fill in the App Id (copy from Azure)
  6. Fill in Client Secret and Tenant ID.
  7. The Redirect URI should be the same as the Azure app.
  8. Check the Use Persistent Access Token Cookies if you want to save your Access Tokens with an expiry date. Leave it unchecked to indicate that the Token will only be used during the current user session

TPC Config

 

Assign a workspace to a capacity

In order to embed content to your portal, you need to assign a Power BI Embedded capacity to your workspace where your content is located.

Ps.: Before creating a Power BI Embedded capacity, make sure you have signed into Power BI at least once.

Follow these steps to create a Power BI Embedded capacity on Azure:

  1. Navigate to https://portal.azure.com/  and sign in.
  2. In the search box, search for Power BI Embedded.
  3. Within Power BI Embedded, select Add.
  1. Fill in the required information and then click Review + Create.
    Capacity

Follow the steps below to assign a capacity to a workspace:

  1. Navigate to https://docs.microsoft.com/en-us/rest/api/power-bi/capacities/groups_assigntocapacity
  2. Click “Try it” and sign in with your Azure Account.

    Capacity Assign

    Capacity Assign 2

  3. Fill in the “groupId” which is the ID of your workspace and “ capacityID” which is the ID of your capacity created in the previous step.

    1. You can find the workspace ID by navigating into the workspace on Power Bi service.

      Workspace ID
    2. You can find the capacity ID by navigating to Power BI Admin portal > Capacity Settings > Power BI Embedded tab.

      Pbi Admin Porta;

    3. Locate your capacity in the list and click the engine icon to view the capacity settings:

      Capacity ID

  4. After inputting the information, click “Run

    Capacity Assign 3

  5. After you select Save, you should see a  diamond next to the workspace name.
  1. Navigate to https://dev.powerbi.com/apps and sign in as a Power BI/Azure administrator.

     

    sign-in-power-bi

  2. Specify any App Name. For App Type, select “Native app"

     

    register-power-bi

  3. In ‘API access’ section, select the following:

     

    api-power-bi

  4. Then register your app by clicking on “Register” button. Note the Application ID

     

    register-complete-power-bi

Follow these additional steps on Azure AD to add permissions that were not in the previous list. 

  1. Go to https://portal.azure.com/
  2. Under Azure Active Directory > App Registrations
  3. Search for the application you just created for Power Bi. 



  4. Click on the app name, and select “API Permissions”.
  5. Click on “Power BI Service



  6. On the right panel, check both “Group.Read” and “Group.Read.All” permissions and click "Add permissions" to save it.

 

    Note: Make sure your account has the required permission to access the application.

    Follow the steps below to grant permission:

    1. Copy the following link and replace {CLIENT_ID} with your Application ID.
    2. https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=
      {CLIENT_ID}&response_type=code&redirect_uri=https://dev.powerbi.com/Apps/SignInRedirect&response_mode=query&scope=https://analysis.windows.net/powerbi/api/.default&state=12345
    3. Paste in a browser window, accept the permissions requested and close the browser window:



    To display reports in The Portal Connector using Power BI Web app, you would need to configure the application in The Portal Connector as follows:

    1. Navigate to the Sitefinity backend
    2. Go to Administration > Settings > Advanced > PortalConnectorMvcPowerBI > Application Configurations
    3. Click Create New
    4. Fill in the information, the App Name here does not have to match your App Name configured previously. The username and password should be for a user that has access to view all the reports/dashboards you want to view.