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

# ServiceNow 連携: 概要

> OAuth 2.0 を介して Iru Endpoint から ServiceNow へ Apple デバイスのインベントリをリアルタイムで同期し、SAM Pro テナントではオプションで毎晩アプリデータを同期します。

### ServiceNow 連携について

ServiceNow 連携は、Iru Endpoint から ServiceNow へ Apple デバイスのインベントリをリアルタイムで送信し、ServiceNow のレコードを常に最新の状態に保ちます。

ServiceNow テナントが Software Asset Management Professional (SAM Pro) のライセンスを持っている場合は、アプリケーションのインストールおよび使用状況データを毎晩送信することもできます。

### 仕組み

この連携は、専用のサービスアカウントを使用して OAuth 2.0 経由で Iru Endpoint を ServiceNow インスタンスに接続します。

**認証**: ServiceNow のサービスアカウントを使用した OAuth 2.0。

**データ同期**: Iru Endpoint は管理対象の Apple デバイスを検出し、シリアル番号、モデル、OS バージョン、割り当てられたユーザーなどのフィールドを ServiceNow に同期します。SAM Pro を使用すると、アプリケーションのインベントリと使用状況データを毎晩送信することもできます。

### セットアップの概要

以下の手順の概要を確認してください。

<Steps>
  <Step title="ServiceNow アプリをインストールする">
    ServiceNow integration hub で [Kandji ServiceNow アプリ](https://store.servicenow.com/sn_appstore_store.do#!/store/application/e330778897bfe150f89bf7021153af52/1.0.0?referer=%2Fstore%2Fsearch%3Flistingtype%3Dallintegrations%25253Bancillary_app%25253Bcertified_apps%25253Bcontent%25253Bindustry_solution%25253Boem%25253Butility%25253Btemplate%25253Bgenerative_ai%25253Bsnow_solution%26q%3Dkandji\&sl=sh)をインストールします。
  </Step>

  <Step title="OAuth クライアントを設定する">
    Iru Endpoint が ServiceNow Import Set API を呼び出せるように、OAuth クライアントアプリを設定します。
  </Step>

  <Step title="ServiceNow ユーザーを作成する">
    ServiceNow API にアクセスできる ServiceNow ユーザーアカウントを作成します。
  </Step>

  <Step title="Iru Endpoint で連携を設定する">
    Iru Endpoint で、作成した OAuth アプリとサービスアカウントを使用して ServiceNow 連携を完了します。
  </Step>
</Steps>

セットアップが完了すると、Iru Endpoint はデバイス資産データの ServiceNow への送信を開始します。

<Warning>
  Iru Endpoint で割り当てられたユーザーをコンピューターレコードに表示するには、そのユーザーが ServiceNow にすでに存在している必要があります。
</Warning>

### データフローの概要

デバイスが Iru Endpoint に登録されるか、そのレコードが変更されると、連携は次の処理を行います。

<Steps>
  <Step title="変更を検出する">
    Iru Endpoint はデバイスインベントリの変更を検出します。Iru Endpoint で SAM Pro アプリ同期を有効にしている場合、アプリのインベントリと使用状況が毎晩準備されます。
  </Step>

  <Step title="ステージングテーブルに送信する">
    Iru Endpoint は ServiceNow Import Set API を介して、これらの変更を ServiceNow のステージングテーブルに送信します。
  </Step>

  <Step title="データを変換する">
    デバイスデータの場合、ServiceNow は [transform map](https://www.servicenow.com/docs/r/zurich/integrate-applications/system-import-sets/c_CreatingNewTransformMaps.html) を実行して、ステージング列をターゲットテーブルにマッピングします。アプリケーションデータは、[Robust Transform Engine](https://www.servicenow.com/docs/r/zurich/integrate-applications/system-import-sets/define-rte-operations.html) を使用した [ETL 定義](https://www.servicenow.com/docs/r/zurich/integrate-applications/system-import-sets/etl-definition-overview.html)を使用します。
  </Step>

  <Step title="レコードを更新する">
    その後、ServiceNow はデバイスおよび MDM レコードを作成または更新し、SAM Pro データ同期が有効な場合はソフトウェアのインストールおよび使用状況レコードも更新できます。
  </Step>
</Steps>

```mermaid actions={false} theme={null}
%%{init: {'theme': 'base', 'themeVariables': { 'lineColor': '#8b93a6', 'primaryTextColor': '#1f2937', 'fontSize': '13px'}}}%%
flowchart TD
    A["Iru Endpoint (外部)<br/>API / エクスポート / 連携"] --> B["ServiceNow - ステージング<br/>Import set: MDM"]
    A --> C["ServiceNow - ステージング<br/>Import set: Computer"]
    A --> D["ServiceNow - ステージング<br/>Import set: Apps"]

    B --> E["MDM レーン<br/>Transform: Iru Endpoint MDM Transformer"]
    E --> F["x_kandj_kandji_mdm"]

    C --> G["Computer レーン<br/>Transform: Iru Endpoint CI Transformer"]
    G --> H["CMDB IRE<br/>discovery_source = Kandji"]
    H --> I["cmdb_ci_computer"]

    D --> J["Apps レーン: RTE の後に ETL<br/>Iru Endpoint Apps RTE"]
    J --> K["Iru Endpoint Apps ETL"]
    K --> L["ETL: Import"]
    L --> M["ETL: Temp"]
    M --> N["cmdb_sam_sw_install"]

    N --> O["SAM 使用状況<br/>スケジュール: Software Usage Publisher"]
    O --> P["samp_sw_usage"]

    I -. "インストールの CI 解決" .-> J

    classDef source fill:#eef6ff,stroke:#3b82f6,stroke-width:1.5px,color:#1f2937;
    classDef mdm fill:#f5f3ff,stroke:#8b5cf6,stroke-width:1.5px,color:#1f2937;
    classDef computer fill:#ecfdf5,stroke:#10b981,stroke-width:1.5px,color:#1f2937;
    classDef apps fill:#fff7ed,stroke:#f97316,stroke-width:1.5px,color:#1f2937;
    classDef usage fill:#fef9c3,stroke:#ca8a04,stroke-width:1.5px,color:#1f2937;

    class A source;
    class B,E,F mdm;
    class C,G,H,I computer;
    class D,J,K,L,M,N apps;
    class O,P usage;
```

### ServiceNow テーブル

Iru Endpoint と ServiceNow の連携では、次のテーブルが使用されます。

| <Icon icon="list-check" size={14} /> **テーブル** | <Icon icon="circle-info" size={14} /> **説明** |
| - | - |
| `cmdb_ci_computer` | Mac、iPhone、iPad、tvOS デバイスのハードウェア詳細を含む ServiceNow の組み込みテーブル。 |
| `cmdb_sam_sw_install` | Iru Endpoint でアプリのインベントリと使用状況の同期が有効な場合に、ソフトウェアのインストールを記録するために使用される ServiceNow SAM Pro テーブル。 |
| `samp_sw_usage` | ServiceNow の夜間 usage-publisher ジョブによって入力される ServiceNow SAM Pro 使用状況テーブル。 |
| `x_kandj_kandji_mdm` | デバイス資産に関する追加の MDM 関連データを保存するために Iru Endpoint が作成したカスタムテーブル。 |
| `x_kandj_kandji_kandji_import_set_computer` | デバイス資産情報を `cmdb_ci_computer` テーブルに送信する前にステージングするために使用される Import set ステージングテーブル。 |
| `x_kandj_kandji_kandji_import_set_mdm` | MDM 関連のデバイス資産情報を `x_kandj_kandji_mdm` テーブルに送信する前にステージングするために使用される Import set ステージングテーブル。 |
| `x_kandj_kandji_kandji_import_set_apps` | RTE/ETL 処理の前にアプリケーションのインベントリと使用状況情報をステージングするために使用される Import set ステージングテーブル。 |

### Iru Endpoint のデバイス属性

Iru Endpoint は以下のデバイス資産フィールドを送信します。今後フィールドが追加される場合があります。

#### テーブル: `cmdb_ci_computer`

| <Icon icon="tag" size={14} /> **Iru Endpoint** | <Icon icon="list-check" size={14} /> **ServiceNow** | <Icon icon="circle-info" size={14} /> **説明** |
| - | - | - |
| `assigned_user` | `assigned_to` | デバイス資産に割り当てられたユーザー |
| `device_capacity` | `disk_space` | 総ストレージ容量 |
| `device_name` | `name` | デバイスの名前 |
| `Discovery source` (Iru には表示されません) | `discovery_source` | "Kandji" に設定される定数値 |
| `model_name` | `model` | デバイスのモデル名 |
| `os_type` | `os` | オペレーティングシステム名 (例: macOS、iOS、iPadOS、tvOS) |
| `os_version` | `os_version` | オペレーティングシステムのバージョン |
| `serial_number` | `serial_number` | デバイスのシリアル番号。ServiceNow のコンピューターテーブルレコードとの照合 (coalesce) にも使用されます |
| `manufacturer` | `manufacturer` | "Apple" に設定される定数値 |

#### テーブル: `x_kandj_kandji_mdm`

| <Icon icon="tag" size={14} /> **Iru Endpoint** | <Icon icon="list-check" size={14} /> **ServiceNow** | <Icon icon="circle-info" size={14} /> **説明** |
| - | - | - |
| `device_id` | `kandji_device_id` | Iru Endpoint のデバイス ID |
| `blueprint_id` | `kandji_blueprint_id` | Iru Endpoint の Blueprint ID。ServiceNow の MDM テーブルレコードとの照合 (coalesce) にも使用されます。 |
| `serial_number` | `computer` | ServiceNow の CI コンピューターレコードを参照します。 |
| `Discovery source` (Iru には表示されません) | `discovery_source` | "Kandji" に設定される定数値 |

#### テーブル: `cmdb_sam_sw_install`

| <Icon icon="tag" size={14} /> **Iru Endpoint (Prism)** | <Icon icon="list-check" size={14} /> **ServiceNow** | <Icon icon="circle-info" size={14} /> **説明** |
| - | - | - |
| `App ID` (Iru には表示されません) | `instance_key` | 特定のデバイス上のソフトウェアを識別するために使用される一意のキー |
| `name` | `name` | アプリの名前 |
| `developer_name` | `publisher` | ソフトウェアの開発元 |
| `version` | `version` | ソフトウェアのバージョン |
| `path` | `install_location` | デバイス上のインストールパス |
| `serial_number` | `installed_on` | コンピューター CI レコードへの参照 |
| `last_opened` | `last_used` | ソフトウェアが最後に使用された日付 |
| `is_removed` (削除されたアプリは Iru には表示されません) | `active` | `cmdb_sam_sw_install` 上の **アクティブなインストール**: アプリがデバイス上にある間は `true`、Iru が削除を報告すると `false`。削除されたアプリも `active` = `false` として同期されるため、ServiceNow は履歴としてインストール行を保持します ([アプリケーションインベントリ](#application-inventory)を参照)。 |
| `Discovery source` (Iru には表示されません) | `discovery_source` | "Kandji" に設定される定数値 |

#### テーブル: `samp_sw_usage`

| <Icon icon="list-check" size={14} /> **ServiceNow** | <Icon icon="circle-info" size={14} /> **説明** |
| - | - |
| `configuration_item` | コンピューター CI レコードへの参照 |
| `norm_product` | ServiceNow のアプリの正規化されたレコード |
| `reclamation_type` | `'last_used'`。Iru は `last_used` エントリを入力します。 |
| `last_used_time` | ソフトウェアが最後に使用された日時。ServiceNow に追加のカスタムテーブルを作成しないように、Iru はここには日付のみを送信します。 |

### アプリケーションインベントリ

<Note>
  アプリケーションインベントリが有効な場合、Iru Endpoint は削除されたアプリも `active` を `false` に設定して ServiceNow に送信します。ServiceNow は、アプリがデバイスから削除されてもそれらのインストール行を削除せず、履歴として保持します。
</Note>

## 考慮事項

<CardGroup cols={2}>
  <Card title="ServiceNow の割り当てユーザー" icon="user">
    ServiceNow のコンピューターレコードに Iru Endpoint で割り当てられたユーザーを表示するには、その人物が ServiceNow にすでに存在している必要があります。
  </Card>

  <Card title="デバイスインベントリの同期" icon="arrows-rotate">
    デバイスインベントリはリアルタイムで同期されます。アプリのインベントリと使用状況データは、そのオプションが有効な場合に毎晩同期されます。
  </Card>

  <Card title="アプリケーションインベントリ" icon="layer-group">
    ServiceNow で SAM Pro のライセンスが必要であり、Iru Endpoint の連携設定でオプションを有効にする必要があります。削除されたアプリも `active` = `false` として同期されるため、ServiceNow は履歴のインストール行を削除せずに保持します。
  </Card>

  <Card title="認証情報の有効期限と再認証" icon="bell">
    ServiceNow の OAuth 認証情報の有効期限が近づくと、Iru Endpoint はテナントにバナーを表示し、有効期限の 30 日前から Admin または Account Owner 権限を持つ Team Members にメールでリマインダーを送信します。Iru Endpoint の [ServiceNow 連携の詳細ページ](/ja/endpoint/integrations/servicenow/servicenow-integration-iru-endpoint-configuration#reauthentication)から再認証してください。
  </Card>

  <Card title="ServiceNow のテーブル" icon="table">
    この連携は ServiceNow の組み込みテーブルと Kandji のカスタムテーブルに書き込むため、CMDB と MDM のビューが完全な状態に保たれます。
  </Card>

  <Card title="Import Set API" icon="plug">
    データは ServiceNow の Import Set API と変換フローを介して移動します。
  </Card>
</CardGroup>

### 関連記事

<CardGroup cols={2}>
  <Card title="ServiceNow 連携: ServiceNow の設定" icon="wrench" href="/ja/endpoint/integrations/servicenow/servicenow-integration-servicenow-configuration">
    Kandji ServiceNow アプリをインストールし、OAuth クライアントとサービスアカウントを作成して、ServiceNow で discovery source を確認します。
  </Card>

  <Card title="ServiceNow 連携: Iru Endpoint の設定" icon="plug" href="/ja/endpoint/integrations/servicenow/servicenow-integration-iru-endpoint-configuration">
    Iru Endpoint をテナントに接続し、OAuth とサービスアカウントの認証情報を入力して、必要に応じて SAM Pro 用の夜間アプリインベントリと使用状況の同期を有効にします。
  </Card>
</CardGroup>
