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

# ユーザーのゾーンの更新

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = localizeLink(href);
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

<RelatedLinks
  title="必須のガイド"
  items={[
{ label: translate("Setup with JWT"), href: "/guides/authentication/jwt/jwt-setup", badge: "GUIDE" }
]}
/>

この[スクリプト][script]は、マルチゾーンのBoxテナント内の特定のデータ保管場所のゾーンにユーザーをプロビジョニングします。スクリプトによって以下の手順が実行されます。

1. 管理者または共同管理者のログインメールアドレスを使用して、関連付けられた企業とその企業に割り当てられているゾーンポリシーを検索します。割り当てられているゾーンポリシーは、特に指定がない限り、すべてのユーザーが継承します。これは、**デフォルトゾーン**とも呼ばれることもあります。
2. ユーザーのメールアドレスとゾーンマッピングが含まれる入力`.csv`ファイルに基づいて、ゾーン割り当てを行います。

<message>
  通常、このスクリプトはユーザーのゾーンを初めてプロビジョニングするときに1回使用します。ただし、ゾーンの割り当てを更新するために、以降の実行でも使用できます。
</message>

ゾーンの割り当てに管理コンソールを使用する場合は、[こちらのガイド][zonesguide]を参照してください。Box Zonesの詳細については、[公式ウェブサイト][zonespage]を参照してください。

## 前提条件

### Windows

[.NET Core](https://dotnet.microsoft.com/download)の最新バージョンのインストール

### macOSおよびLinux

[PowerShell][pwsh]をインストールします。`pwsh`コマンドを実行して、インストール結果をテストします。

```bash theme={null}
pwsh
```

どのディレクトリでこのコマンドを実行するかに応じて、出力が異なる場合があります。以下に例を示します。

```bash theme={null}
PowerShell 7.2.5
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /Users/user/repos/boxcli/examples>
```

<message>
  問題が発生する場合は、[.NET Core](https://dotnet.microsoft.com/download)と[PowerShell][pwsh]の両方をインストールしたかどうか確認してください。
</message>

### JWT認証を使用するアプリケーションの設定

このスクリプトを使用するには、<Link href="/guides/cli/cli-with-jwt-authentication/jwt-cli">JWT認証を使用するBox CLI</Link>をインストールし、構成する必要があります。

アプリを作成する際は、\[**構成**] タブで以下の設定を構成します。

* \[**アプリアクセスレベル**] で \[`App + Enterprise Access`] を選択します。
* \[**アプリケーションスコープ**] > \[**管理操作**] の順に移動して、\[`Manage Enterprise Properties`]、\[`Manage Users`] を選択します。
* \[**高度な機能**] で \[`Generate user access tokens`] を選択します。

### 管理者設定の調整

Boxの管理者または共同管理者に`Manage Users`以上の権限があることを確認します。この設定を確認するには、以下の手順に従います。

1. 管理コンソールの \[**ユーザーとグループ**] セクションに移動します。
2. 確認するユーザーアカウントをクリックします。
3. \[**ユーザーのアクセス権限を編集**] セクションに移動して、ユーザーとグループに管理者権限を付与します。

## `.csv`ファイルの準備

`.csv`ファイルには、**Email**と**Region**というヘッダーを設定した2つの列が必要です。

* **Email**列には、Boxユーザーのプライマリメールアドレスを含めます。
* **Region**列には、スクリプトでユーザーを割り当てるゾーンのユーザーフレンドリ名 (ユーザーが理解しやすい名前) を含めます。この名前は、ゾーンの定義に使用する[ZonesTable][zonestable]というハッシュテーブルで指定します。キーはゾーンのユーザーフレンドリ名であり、対応する値はゾーンのグローバルIDです。

  ```bash theme={null}
  $ZonesTable = @{
      US = "100001"             #US
      GermanyIreland = "100002" #Germany/Ireland with in region uploads/downloads/previews
      Australia = "100003"      #Australia
      Japan = "100004"          #Japan with in region uploads/downloads/previews
      Canada = "100005"         #Canada
      JapanSingapore = "100007" #Japan/Singapore with in region uploads/downloads/previews
      UKGermany = "100008"      #UK/Germany
      UK = "100009"             #UK with in region uploads/downloads/previews
      France = "100012"         #France
  }
  ```

<message>
  特定の企業で有効なゾーンに対応するIDを入手するには、Box Consultingまたはカスタマーサクセスマネージャまでお問い合わせください。
</message>

このスクリプトには、以下のようなメールアドレスとゾーン名が含まれているサンプル入力`.csv`ファイルが用意されています。

| Email               | Region         |
| ------------------- | -------------- |
| `betty@company.com` | US             |
| `roger@company.com` | France         |
| `sally@company.com` | JapanSingapore |

## スクリプトの構成

この`.csv`ファイルを指すように`UserZonesUpdatePath`を設定します。

```bash theme={null}
$UserZonesUpdatePath = "./your_file_name.csv"
```

`adminEmail`を、このスクリプトでゾーンの割り当てに使用するアカウントの管理者または`co-admin`のログインメールアドレスに更新します。この値を指定しない場合、スクリプト実行時に指定するよう求められます。

```bash theme={null}
$adminEmail = "john@box.com"
```

## スクリプトの実行

PowerShellコマンドを実行します。

```bash theme={null}
pwsh
```

スクリプトを実行します。

```bash theme={null}
./Mass_Update_User_Zones.ps1
```

### オプションのフラグ

シミュレーションモードでスクリプトを実行するには、`DryRun`ブール値フラグを追加します。ドライランでは、APIコールが実行されないというわけではありませんが、作成/更新/削除のコールはすべてスキップされます。

```bash theme={null}
./Mass_Update_User_Zones.ps1 -DryRun
```

## ログ

ログは、メインフォルダ内の`logs`フォルダに格納されます。以下のログファイルにアクセスできます。

* `Mass_Update_User_Zones_all.txt`: すべてのログエントリが含まれています。
* `Mass_Update_User_Zones_errors.txt`: エラーのみが含まれています。

[zonesguide]: https://support.box.com/hc/en-us/articles/360044193533-Assigning-Zones-through-the-Admin-Console

[script]: https://github.com/box/boxcli/tree/main/examples/Mass%20Update%20User%20Zones

[zonespage]: https://www.box.com/zones

[zonestable]: https://github.com/box/boxcli/blob/main/examples/Mass%20Update%20User%20Zones/Mass_Update_User_Zones.ps1#L23

[scripts]: https://github.com/box/boxcli/tree/main/examples

[pwsh]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.2

[console]: https://app.box.com/developers/console

<RelatedLinks
  title="関連するガイド"
  items={[
{ label: translate("JWT Auth"), href: "/guides/authentication/jwt/index", badge: "GUIDE" },
{ label: translate("PowerShell script templates"), href: "/guides/cli/scripts/powershell-script-templates", badge: "GUIDE" },
{ label: translate("Deprovision users and archive folders"), href: "/guides/cli/scripts/deprovision-users", badge: "GUIDE" }
]}
/>
