> ## Documentation Index
> Fetch the complete documentation index at: https://soalinc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Powerbi

<Warning> Only an admin can set up the PowerBI integration. </Warning>

# Getting Started with Power BI

Integrate Power BI with Soal using two methods:

1. OAuth with Soal's managed Power BI Azure Enterprise Application (**OAuth**)
2. Create and manage a Power BI Azure Enterprise Application (**Azure AD App**)
   * Utilize Admin APIs
   * Utilize Non-Admin APIs

## OAuth

Soal's Power BI integration utilizes OAuth 2.0 to connect to your Power BI workspace. Here's how to establish the connection:

1. Navigate to `Integrations` on the sidebar, click `New integration` and choose `Power BI`.
2. Go to the `OAuth` tab.
3. Click `Connect with OAuth`. This action redirects you to a login page requesting permissions for your Power BI workspace.
4. After successful OAuth authentication, click the `Run Initial Sync` button.

## Azure AD App

Follow these steps to set up Power BI Integration via Azure AD App:

### Step 1: Create an Azure AD App

1. Open the Azure portal.
2. Search for `App registrations` and click `+ New registration`.
3. Fill in the form with the following details:
   * **Name**: Soal
   * **Supported account types**: Accounts in this organizational directory only (Default Directory only - Single tenant)
   * **Redirect URI (optional)**: Leave blank
4. Click `Register`.
5. Post submission, copy and save the `Application ID` (Client ID) and `Tenant ID` from the Overview tab.
6. Click `Certificates & secrets` tab, then `New client secret`.
7. Enter a description, specify the expiration for the client secret, and click `Add`.
8. Copy and save the `Client secret value`.

### Step 2.1: (Only for non-admin API)

1. Navigate to `API permissions` tab, click `Add a permission` to add necessary permissions.

### Step 2.2: (Only for admin API)

1. Re-open the Azure portal.
2. Search and select `Azure Active Directory` link.
3. Click `Groups` tab, then `New group`.
4. Complete the form with the following:
   * **Group type**: Security
   * **Group name**: PowerBI API Access
   * **Group description**: (Optional)
5. Click `Create`.

### Step 2.3: (Only for admin API) Enable Power BI service admin settings

1. Sign in to the Power BI admin portal.
2. Ensure `Tenant settings` tab is open.
3. Under `Developer settings`, find and open the subsection "Allow service principals to use Power BI APIs". Select `Enabled` and add the security group `PowerBI API Access` created earlier.
4. Repeat the above for all subsections in "Admin API settings", enabling and adding the security group.

### Step 3: Add Azure AD app to your workspace

1. Sign in to Power BI.
2. Search and select the workspace, then from the `More` menu, choose `Workspace access`.
3. Search for Soal as a member, select the entry.
4. Choose `Viewer` or `Contributor` for Permission.
5. Click `Add` and then `Close`.

### Step 4: Connect PowerBI API to Soal

1. Go to `Integrations` in the sidebar, click `New integration` and select `Power BI`.
2. Fill in the details from Step 1:
   * **Client ID**: Application ID of Azure AD.
   * **Tenant ID**: Identifier of tenant of organization in Azure Active AD.
   * **Client Secret**: Client secret of the Azure AD App.
3. Click `Connect`.

**note:**

* Non-admin API doesn't support extracting tables, columns, and measures from PowerBI datasets (except for push datasets).
* You need PowerBI Admin privileges to successfully complete the OAuth flow.
