# Granting the migrator role

The migrator role gives a user or team the ability to run migrations on behalf of an organization.

To allow someone other than an organization owner to run a migration or download migration logs, you can grant the migrator role to a user or team.

To grant the migrator role using the CLI, you can use the ADO2GH extension of the GitHub CLI.

1. Установите GitHub CLI.
   * Инструкции по установке для GitHub CLI см. в [репозитории GitHub CLI](https://github.com/cli/cli#installation).
   * Если уже установлена GitHub CLI , запустите `gh --version` , чтобы убедиться, что у вас версия 2.4.0 или новее. Если у вас более старая версия, посетите [GitHub CLI репозиторий](https://github.com/cli/cli#installation) для инструкций по обновлению.
1. Установите ADO2GH extension.

   ```shell copy
   gh extension install github/gh-ado2gh
   ```

1. Обновление ADO2GH extension of the GitHub CLI обновляется еженедельно. Чтобы убедиться, что вы используете последнюю версию, обновите расширение.

    ```shell copy
    gh extension upgrade github/gh-ado2gh
    ```

1. On GitHub, create and record a personal access token that has the `admin:org` scope.
1. Задайте для personal access token в качестве переменной среды, заменив TOKEN в командах ниже personal access token, записанных выше.

   * Если вы используете терминал, используйте `export` команду.

      ```shell copy
      export GH_PAT="TOKEN"
      ```

   * Если вы используете PowerShell, используйте `$env` команду.

      ```shell copy
      $env:GH_PAT="TOKEN"
      ```
1. Use the `gh ado2gh grant-migrator-role` command, replacing ORGANIZATION with the organization you want to grant the migrator role for, ACTOR with the user or team name, and TYPE with `USER` or `TEAM`.

   ```shell copy
   gh ado2gh grant-migrator-role --github-org ORGANIZATION --actor ACTOR --actor-type TYPE
   ```

   >[!NOTE] Если вы предоставляете роль GHE.comмиграции для, необходимо также включить URL-адрес целевого API для поддомена предприятия. Например: `--target-api-url https://api.octocorp.ghe.com`.