# 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="/files/41uvQk00ZmVhfFEqhhsg" alt="" data-size="original">

Click the “+ Add people or groups” button.

<img src="/files/obMT81zqPsOu55MBreE8" 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="/files/6dRkPs0037TeByb1TNOD" 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="/files/PXOAobwW9f9e1E9l4fHO" alt="" data-size="original">

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

<img src="/files/9RS5DPJQkS6OhXJT1Bg8" alt="" data-size="original">

Then, choose **Application permissions**.

<img src="/files/NDs8cSFl4NpzIBMIVD6w" 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="/files/RNlrm85x1WbuDtcLcPk9" alt="" data-size="original">

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

<img src="/files/EkPq9MKQHraRCWJpcBwl" 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="/files/mnD9tDn2wDvj5vQptg2O" 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="/files/FeCOxyoGfq20FmV3Ug58" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/QNLnaFCiaSPFkltMnJvw" 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="/files/2i4OmKfU3lKSNlqYGZtE" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/EdC2pOHGdCw5YHfF9K0R" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/KjAM9Ksby3TbaPzcNK35" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/ycWVxEVx3iGd16E5ZrM0" alt=""><figcaption></figcaption></figure>

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.powerembedded.com.br/en/administration-portal/migration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
