# Migration

To simplify the configuration of Power Embedded, we have prepared a script that automates the process of importing users, RLS, and Power BI reports into Power Embedded in a simple and easy way.

## Requirements

To successfully execute the migration process, the following permissions must be enabled:

<details>

<summary>Admin permission for the service user</summary>

This permission must be enabled in all workspaces that will be available in the portal.

To add the created Service Principal as a workspace administrator, access the workspace, click on the three dots, and select the "Manage access" option.

<img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-2931b827d7d8b0ef632bc96d73e16cf8e1ca9bd5%2Fapp%201.png?alt=media" alt="" data-size="original">

Click the “+ Add people or groups” button.

<img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-62f8c4206e291a8f6c43f6970876977c1b54d223%2Fapp%202.png?alt=media" alt="" data-size="original">

PSearch for the name of the previously created application (**PowerEmbedded-App**) and remember to change the access level to **Administrator**. Then, click the **Add** button.

<img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-5c345db1519cb81ac91bb50fd9157c84f8034135%2Fapp%203.png?alt=media" alt="" data-size="original">

That's it! Power Embedded now has access to this workspace. Repeat this process for all workspaces from which you want to import reports.

</details>

<details>

<summary>API Read Permissions</summary>

Permissions for Importing Data from Entra ID

To import user and group data from Entra ID, specific permissions must be assigned to the Service Principal created in the **Azure Portal**, which is used by Power Embedded to communicate with your environment.

In the [**App Registrations**](https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/RegisteredApps) screen, search for the name of the created application (the default name is **PowerEmbedded-App**).

In the application screen, click on **API Permissions** in the side menu and then on *Add a Permission*

<img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-e60e046eccabc2ed7da60529ce7e2aba2982a633%2Fsin%201%20small.png?alt=media" alt="" data-size="original">

On the next screen, select the **Microsoft Graph** option.

<img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-cc735805e56d0d3ee4541755d9e11eb190b362f3%2Fsinc%202%20small.png?alt=media" alt="" data-size="original">

Then, choose **Application permissions**.

<img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-50cf80c1b66833fbca5f256753a303894842b0e9%2Fsinc%20small%203.png?alt=media" alt="" data-size="original">

In the following tab, search for **Directory** and select the first option, **Directory.Read.All**, then click **Add permissions**.

<img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-8e7c42a6b4c89c21ef68627b3471d3c949cbf548%2Fsinc%20small%204.png?alt=media" alt="" data-size="original">

To finalize, grant admin consent by clicking on **Grant admin consent for**.

<img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-8af8aeaf6b981ce7b2fce91f9a17f3a804bfe0b4%2FScreenshot%202024-10-29%20164709.png?alt=media" alt="" data-size="original">

That's it! Now you will be able to import users and groups from **Azure AD (Entra ID)** into **Power Embedded**.

</details>

## Instructions

With the necessary permissions enabled, simply follow the step-by-step process below.

Go to the Power Embedded administration portal, navigate to the migration menu, and follow these steps:

**Step 1:** Generate the access tokens using the button below and copy them. The generated token will be valid for only 1 hour.

<figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-5c96b7ad9141e3dbb537bb40f19d47381da965af%2Fimage%20(382).png?alt=media" alt=""><figcaption></figcaption></figure>

**Step 2:** Open the PowerShell script available in the link on this page, copy it, and paste it into the PowerShell console.

**Step 3:** Replace the script variables with their respective values:

<figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-4104944e46b8389dd5e5d72b2bf68518e6b48b58%2Fimage%20(383).png?alt=media" alt=""><figcaption></figcaption></figure>

**Power BI Client ID:** Access the Power BI Embedded Administration Portal > Settings > “Power BI Client ID” field.

<figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-e72c5e26c8040dac89838be3803555ccb46f0d9f%2Fimage%20(384).png?alt=media" alt=""><figcaption></figcaption></figure>

**API Key:** Access the Power BI Embedded Administration Portal > Settings > “API Key” field (click the red icon to generate the key).

<figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-8abae1fb09f592972fe67cff825cacd207cf555c%2Fimage%20(385).png?alt=media" alt=""><figcaption></figcaption></figure>

**PBI Token:** Key generated in the migration menu.

<figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-bdc0ef265d5a48acb7b3983d294ddb555cba1078%2Fpbi.png?alt=media" alt=""><figcaption></figcaption></figure>

**AD Token:** Key generated in the migration menu.

<figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-cfef86462b0e94e3a3352b98d125d876cea6c03a%2Fad.png?alt=media" alt=""><figcaption></figcaption></figure>

With all the fields filled in, simply run the script in PowerShell.

<figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-ff933686e85655ed5ad43a7cca30fb9d60827914%2Fprint%208.png?alt=media" alt=""><figcaption></figcaption></figure>

Once the script is completed, all reports, users, and RLS will be successfully imported into Power Embedded.
