> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/setting-up-azure-ad.md).

# Azure AD の設定

ドキュメント閲覧者向けに Azure AD のログイン画面を設定します

{% hint style="warning" %}
このガイドでは、ドキュメント用の保護されたサインイン画面を設定する手順を説明します。このガイドを始める前に、まず次の手順を完了してください。 [認証済みアクセスを有効にする](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/enabling-authenticated-access.md).
{% endhint %}

{% hint style="info" %}
Azure 統合には既知の制限があり、認証時に見出しの URL フラグメントは削除されます。ユーザーは引き続き正しいページに移動しますが、URL の見出しではなくページの先頭に移動します。ユーザーが一度認証されると、この動作はそのセッション中は発生しなくなり、ユーザーは正しい見出しに誘導されます。

これは Microsoft によって実装されたセキュリティ対策によるものです。
{% endhint %}

### 概要

Azure AD を使用した認証アクセスで GitBook サイトをセットアップする手順は次のとおりです:

{% stepper %}
{% step %}
[**Azure AD でアプリの登録を作成する**](#id-1.-create-an-app-registration-in-azure-a-d)

Microsoft Entra ID 管理ダッシュボードで Azure AD アプリケーションの登録を作成します。
{% endstep %}

{% step %}
[**サイトに Azure AD 統合をインストールして構成する**](#id-2.-install-and-configure-the-azure-a-d-integration)

Azure AD 統合をインストールし、必要な構成を GitBook サイトに追加します。
{% endstep %}

{% step %}
[**アダプティブ コンテンツ用に Azure AD を構成する（オプション）**](#id-3.-configure-azure-a-d-for-adaptive-content-optional)

GitBook のアダプティブ コンテンツで動作するように Azure AD を構成します。
{% endstep %}
{% endstepper %}

### 1. Azure AD でアプリの登録を作成する

まず、Microsoft Entra ID ダッシュボードでアプリの登録を作成します。このアプリケーション登録により、GitBook Azure AD 統合は、サイトへのアクセスを許可する前にユーザー ID を検証するためのトークンを要求できるようになります。

1. Microsoft Entra ID 管理者の [ダッシュボードにサインインします](https://entra.microsoft.com/).
2. 左側のサイドバーから **「ID」** > **→「アプリケーション」** > **→「アプリの登録」** に移動します。
3. 「 **+ 新規登録」をクリックし、** 登録名を入力します。
4. 「 **サポートされているアカウントの種類」** で「**この組織のディレクトリ内のアカウントのみ（既定のディレクトリのみ - シングルテナント）**.
5. リダイレクト URI フィールドは今は空欄のままにしてください。後で入力する必要があります。
6. を選択します。「 **登録** 」をクリックして、アプリの登録を完了します。<br>

   <figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-d792b2da26ce7e72515dc0e7454f30e3bab80285%2F25_04_10_azure_ad_integration_register_app.png?alt=media" alt="An Azure screenshot showing how to register an Azure AD app"><figcaption><p>GitBook VA 統合用のアプリを登録します。</p></figcaption></figure>
7. 新しく登録したアプリの **概要** 画面が表示されます。 **「アプリケーション（クライアント）ID」** と **「ディレクトリ（テナント）ID」**.<br>

   <figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-9e4a45be03c340e973c5caaa92070a499955287b%2F25_04_10_azure_ad_integration_app_reg_overview.png?alt=media" alt="An Azure screenshot showing the app registration overview"><figcaption><p>新しく作成されたアプリ登録の概要。</p></figcaption></figure>
8. をコピーして控えておきます。「 **証明書またはシークレットの追加**」をクリックします。次の **「証明書とシークレット」** 画面が表示されます。<br>

   <figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-a3e1600c315de0d7549a0a4c85cc7e45dc4c59b4%2F25_04_10_azure_ad_integration_client_secrets.png?alt=media" alt="An Azure screenshot showing where to add a certificate or secret"><figcaption><p>証明書またはシークレットを追加します。</p></figcaption></figure>
9. 「 **+ 新しいクライアント シークレット**.
10. シークレットに適切な説明を入力し、 **追加**.
11. 」をクリックします。作成したシークレットの **値** フィールド（***「シークレット ID」では** なく*）をコピーして控えておきます。

### 2. Azure AD 統合をインストールして構成する

Azure AD アプリ登録を作成したら、次の手順は GitBook に Azure AD 統合をインストールし、先ほど生成した資格情報を使って Azure アプリケーションにリンクすることです:

1. 認証済みアクセスを [有効にした](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/enabling-authenticated-access.md#enable-authenticated-access) サイトに移動し、ID プロバイダーとして Azure AD を使用します。
2. サイトの設定画面の右上にある **「インテグレーション」** ボタンをクリックします。<br>

   <figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-36cf49e13fdd37a9c62aedf792e698c2451e34ba%2F25_04_10_va_site_integration_overview_screen.png?alt=media" alt="A GitBook screenshot showing the site settings overview"><figcaption></figcaption></figure>
3. サイドバーのカテゴリから「 **認証済みアクセス** 」をクリックします。
4. 「 **Azure** 統合。
5. クリック **このサイトにインストール**.<br>

   <figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-b721d799f2ae94d5d247b6118a9cfe6c5ee5f555%2F25_04_10_azure_ad_install_on_site_screen.png?alt=media" alt="A GitBook screenshot showing installation of the Azure AD integration"><figcaption></figcaption></figure>
6. サイトに統合をインストールすると、統合の構成画面が表示されます:<br>

   <figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-ad94a4b9eff107036f35d03620e38615d43b9493%2F25_04_10_azure_ad_config_dialog.png?alt=media" alt="A GitBook screenshot showing the Azure AD configuration dialog"><figcaption></figcaption></figure>
7. 次の値を入力します。 **クライアント ID**, **テナント ID**と **クライアント シークレット** 先ほどコピーした値を入力し、 [Azure AD アプリの登録を作成](#id-1.-create-an-app-registration-in-azure-a-d) した後、「保存」をクリックします。
8. ダイアログの下部に表示された **URL** を **コピーします。**.
9. Microsoft Entra ID ダッシュボードで先ほど作成した Azure AD アプリ登録に戻ります。
10. サイドバーで **「管理」** > **「認証」** に移動します。
11. をクリックします **+ プラットフォームを追加** をクリックし、開いたパネルで **Web** カードを選択します。<br>

    <figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-785a4dd4a2d5e0994f0951d0c3eca13b9405d11f%2F25_04_10_azure_ad_app_reg_authentication.png?alt=media" alt="An Azure screenshot showing authentication platform settings"><figcaption></figcaption></figure>
12. 先ほどコピーしたGitBook統合の **URL** を **リダイレクトURI** フィールドに貼り付け、「構成」をクリックします。<br>

    <figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-ca64e69ddb80de5149ea0453553d2136669c59cf%2F25_07_21_image.png?alt=media" alt="An Azure screenshot showing where to enter the redirect URI"><figcaption></figcaption></figure>
13. GitBook の **Azure 統合** インストール画面 **に戻ります。**.
14. 統合のダイアログを閉じ、サイト画面の **「設定」** タブをクリックします。
15. 「 **対象ユーザー** に移動し、 **「認証済みアクセス」** （まだ選択されていない場合）を選択します。
16. 「 **Azure** 」を **「認証バックエンド」** セクションのドロップダウンから選択します。
17. 「 **対象ユーザーを更新**.<br>

    <figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-c73d425e06d977e52b03147cfea0ff4fe5bc9a0b%2F25_04_10_setting_up_azure_ad.png?alt=media" alt="A GitBook screenshot showing authenticated access settings"><figcaption></figcaption></figure>
18. 」をクリックします。 **サイトの概要画面に移動し、「公開」をクリックします。** サイトがまだ公開されていない場合。

これで、ID プロバイダーとして Azure AD を使用した認証アクセスの背後でサイトが公開されました。

確認するには、「Visit」をクリックします。Azure でサインインするよう求められます。これにより、サイトが Azure を使用した認証アクセスの背後で公開されていることが確認できます。

{% hint style="info" %}
公開されたコンテンツの URL にアクセスし、Azure の資格情報でログインすると、管理者に「承認をリクエスト」する必要があることを示す画面が表示される場合があります。管理者は公開されたコンテンツの URL にアクセスしてログインし、組織に代わって承認を付与することで、このリクエストを承認できます。
{% endhint %}

### 3. アダプティブ コンテンツ用に Azure AD を構成する（オプション）

認証アクセスサイトでアダプティブ コンテンツ機能を活用するには、Azure AD アプリ登録を構成して、認証トークンに追加のユーザー情報をクレームとして含めるようにします。

キーと値のペアで表されるこれらのクレームはGitBookに渡され、次の用途に使用できます。 [コンテンツを動的に調整](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/adaptive-content/adapting-your-content.md) して、サイト訪問者に表示できます。

Azure AD はさまざまな種類とレベルのクレームをサポートしており、それぞれ設定方法が異なります:

* **標準クレーム**：トークンに含まれることがある一般的なクレームですが、デフォルトで常に含まれるとは限りません。

{% hint style="info" %}
Azure ADはパフォーマンスを最適化するため、トークンのサイズを小さく保ちます。そのため、多くのクレームは **デフォルトでは** トークンに含まれず、アプリケーションから明示的に要求する必要があります。次のようなクレームを確実に含めるには、 `email` , `groups` または `roles` 明示的に **オプショナルクレーム**.
{% endhint %}

* **オプショナルクレーム**：アプリケーションで有効にできる、事前定義済みの追加クレームです。
* **カスタムクレーム**：Azure ADのカスタムユーザー属性、またはカスタムクレームプロバイダーを介した外部システムをソースとするクレームです。

Azure AD アプリによって生成されるトークンにこれらのさまざまな種類のクレームを含める方法の詳細については、次の Microsoft Entra のドキュメント ガイドを参照してください:

* [ユーザー属性](https://learn.microsoft.com/en-us/entra/external-id/customers/how-to-add-attributes-to-token)
* [オプション クレーム](https://learn.microsoft.com/en-us/entra/identity-platform/optional-claims?toc=%2Fentra%2Fexternal-id%2Ftoc.json\&bc=%2Fentra%2Fexternal-id%2Fbreadcrumb%2Ftoc.json\&tabs=appui)
* [カスタム クレーム](https://learn.microsoft.com/en-us/entra/identity-platform/custom-claims-provider-overview)

GitBook に送信する適切なクレームを設定したら、「[コンテンツの適応](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/adaptive-content/adapting-your-content.md)」に進み、サイトの設定を続けます。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access/setting-up-azure-ad.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
