# Power BI Service Principal

Adding your own "*Power BI Service Principal*" provides several benefits. Firstly, it allow for the embedding of reports for audiences without Power BI Pro licenses, such as those using User Pass, Mobile ID, or Azure AD without Pro License. Additionally, the Service Principal can act as a fallback in situations where an Azure AD user does not have access to a workspace, allowing for embedding through the Service Principal. Moreover, numerous [features](https://uidata.gitbook.io/datacentral-knowledge-center/product-guides/features) within the system rely on the Service Principal for effective operation.

## Add Power BI Service Principal

To create your own Service Principal, you can follow the steps outlined in the Microsoft documentation. And then to add the Service Principal to DataCentral, please perform all the steps below in the specified order.

You will need one of these following roles within Azure to create an app registration.

* Application Administrator
* Cloud Application Administrator
* Global Administrator

Step-by-step guide:

1. [Azure Portal](#azure-portal)
2. [DataCentral tenant](#datacentral-tenant)
3. [Power BI Service](#power-bi-service)

### **Azure Portal**

Embed Power BI content with Service Principal and an application secret

* [x] [Create a Microsoft Entra app](#create-a-microsoft-entra-app)
* [x] [Enable the Power BI service admin settings](#enable-the-power-bi-service-admin-settings)

#### Create a Microsoft Entra app

In the Azure portal create a Microsoft Entra App

1. Sign in to [Azure portal](https://ms.portal.azure.com/#allservices)

2. Search for and select **App registrations**<br>

   <div align="left"><figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FYAn6jIQoInEP586M3gJq%2Fimage.png?alt=media&#x26;token=8b00ba1c-d2a8-434c-bc4c-10ea742813ca" alt=""><figcaption><p>App registration</p></figcaption></figure></div>

3. Select **"New registration"**<br>

   <figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FTTxkMWUNF7GSJazEOfuI%2Fimage.png?alt=media&#x26;token=a2ed784e-1859-48d5-bdb7-cea297d35eb6" alt=""><figcaption><p>New registration</p></figcaption></figure>

4. Fill in the required information

   * **Name** - Enter a name for your application
   * **Supported account types** - Select supported account types
   * **Redirect URI** - Leave this empty

   <br>

   <figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FidJ2ZIZjsVDu9D08Q8Ji%2Fimage.png?alt=media&#x26;token=4cb96f14-dbf3-4901-99db-64a6d56735fc" alt=""><figcaption></figcaption></figure>

5. Select **Register**

6. After you register your app, the **Application (client) ID** is available from the **Overview** tab. Copy and save the **Application (client) ID** for later use.<br>

   <figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FS9ufNyMMk5aJtP2LuKN4%2Fimage.png?alt=media&#x26;token=10d3d0ab-a5d6-4828-bdf3-e56c0963c93d" alt=""><figcaption><p>Application (client) ID</p></figcaption></figure>

7. Select **Manage** and **Certification & secrets**<br>

   <figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FtsqHMMtQyL1U6ecnjbxj%2Fimage.png?alt=media&#x26;token=d95bdb88-2d0c-47a7-83eb-804de4d1dcf7" alt=""><figcaption><p>Certificated &#x26; secrets</p></figcaption></figure>

8. Select **New client secret**<br>

   <figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2F1iCwjluIaP4VqZIVMA3h%2Fimage.png?alt=media&#x26;token=ee6f830d-1bea-468d-9d14-467811d551bc" alt=""><figcaption><p>New client secret</p></figcaption></figure>

9. In the **Add a client secret** window, enter a description, specify when you want the client secret to expire (2 years recommended), and select **Add**.

10. Copy and save the client secret value.<br>

    <figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FPfhsI4sPJI554bqUXA6P%2Fimage.png?alt=media&#x26;token=772a9cc1-a31f-4c32-96f5-55531129e080" alt=""><figcaption><p>Client secret value</p></figcaption></figure>

#### Enable the Power BI service admin settings

For a Microsoft Entra app to access the Power BI content and APIs, a Power BI admin needs to enable the following settings:

* Embed content in apps
* Allow service principals to use Power BI APIs
*

In the [**Power BI Admin portal**](https://learn.microsoft.com/en-us/power-bi/admin/service-admin-portal), go to **Tenant settings**, and scroll down to **Developer settings**.

* Enable **Embed content in apps** either for the entire organization or for the specific security group you created in Microsoft Entra ID.

<figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FLFinp9htEwK72gtGDyOv%2Fimage.png?alt=media&#x26;token=eb2d0f8e-efaf-48e0-a8f6-c40208819df0" alt=""><figcaption><p>Admin Tenant Settings</p></figcaption></figure>

<figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FwrOu5EvGhsSwjimwNdF5%2Fimage.png?alt=media&#x26;token=d94e08e4-13f5-4c0e-97e8-0b1f5b8c1c0e" alt=""><figcaption></figcaption></figure>

<p align="center">Alternately use Security Groups, but remember to put the Service Principal(s) into that Security Group.</p>

<p align="center"></p>

* Enable **Allow service principals to use Power BI APIs** either for the entire organization or a specified Security Groups as shown in the images below.

<figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FvgX07YsuPOiuxGIw36tB%2Fimage.png?alt=media&#x26;token=b0ec9000-1784-4876-a298-2fd89f2f4406" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2Fv7xJGWoX5KiBLbo6D5ra%2Fimage.png?alt=media&#x26;token=af145d12-e387-4f95-b61b-50ae39543ba3" alt=""><figcaption></figcaption></figure>

***

### Power BI Service

Add your Service Principal as a MEMBER or ADMINISTRATOR to the workspaces you plan to embed within your tenant or use with your tenant's features. The minimum permission level assignable to the Service Principal is 'member'.

Sign in to the [Power BI Environment](https://app.powerbi.com/) you intent to use the Power BI Service Principal.

{% hint style="info" %}
**Important:** Your service principal must have, at a minimum, **'member'** permissions in the workspace to which you are adding it.
{% endhint %}

Find workspace select **Manage access**

<figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2Fg7Vrapnzxlv4aeVPJaps%2Fimage.png?alt=media&#x26;token=a64d4273-1e58-4253-a1db-f70651d4d095" alt=""><figcaption><p>Workspace</p></figcaption></figure>

Add your Power BI Service Principal to the workspace either as **admin** or **member**.

<figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FhjKI6AW91H7qhgv3egFr%2Fimage.png?alt=media&#x26;token=6a99bf58-2cf1-4f8c-b235-353e7e50fb6c" alt=""><figcaption><p>Add member</p></figcaption></figure>

***

### DataCentral tenant

Authenticate to your tenant.

Under Administration Settings -> Azure Configurations input the values collected from Azure Portal for your Service Principal.

* Directory (tenant) ID
* Application (client) ID
* Client Secret

If you check the box "*Only use Service Principal to manage items and workspaces in tenant*" in Azure Configurations then you will only see workspaces your Service Principal(s) has access to. If the box is unchecked the normal workspace management will occur through your Azure AD user.

<figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FTtrtw5Tibw7qucxkfkgZ%2Fimage.png?alt=media&#x26;token=815fbd7a-d2e5-4f41-9ddb-7acfa04b8e54" alt=""><figcaption><p>Azure Configuration</p></figcaption></figure>

If you enable "*Only use Service Principal to manage items and workspaces in tenant*" then you can tres your Service Principal. Navigate to **Power BI Items** and select **Manage workspaces.**

<figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FtP4UlUa0TjvET9l7ppaF%2Fimage.png?alt=media&#x26;token=906311e8-03a9-468d-8f60-b41e2215c77f" alt=""><figcaption><p>Power BI Items</p></figcaption></figure>

If steps followed correctly you should now be able to embed report from workspace(s) to your tenant.

<figure><img src="https://1952150759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfEoiVXBZDmtsCCNsaMab%2Fuploads%2FfhnW697CzQ7i02ZrysZp%2Fimage.png?alt=media&#x26;token=a9a72c38-1ace-41b1-a7ef-6fbbe64c61dd" alt=""><figcaption><p>Workspaces</p></figcaption></figure>
