> For the complete documentation index, see [llms.txt](https://docs.realmjoin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmjoin.com/ja/zi-dong-hua/runbooks/runbook-references/device/general/outphase-device.md).

# デバイスを廃止

この Windows デバイスを初期化し、Intune、Autopilot、Entra ID の情報をクリーンアップします

### 説明

この Windows デバイスを使用停止にします。デバイスを消去するか、Intune からのみ削除するか、また Autopilot データベースからも削除するかを選択できます。Entra ID オブジェクトは削除、無効化、または保持できます。必要に応じて、デバイスには Microsoft Defender for Endpoint でタグが付けられ、そのタグを使用するルールが自動修復の対象から除外できます。消去するとデバイスからすべてのユーザー データと登録データが削除され、元に戻すことはできません。

### Microsoft Defender for Endpoint の除外タグ

Microsoft Defender for Endpoint にはネイティブの **除外状態** （Device Inventory フィルターでは *除外済み* / *除外されていない*）この状態は Defender ポータルからのみ設定できます — **API はありません** デバイスのネイティブな除外状態をプログラムで設定するための。

ネイティブの除外状態は自動化できないため、この runbook では代わりにカスタム デバイス タグ（既定値 `ExcludeFromRemediation`）を *Microsoft Defender for Endpoint からデバイスを除外* が有効になっています。デバイスは Entra ID のデバイス ID で検索され、次を介してタグ付けされます: `POST /api/machines/{id}/tags`を通じてタグ付けされます。これにより、除外されたデバイスをフィルターして対象にするためのマーカーが提供されます。

#### 一度だけの設定: タグをフィルター可能にする

ポータルの **タグ** 残念ながら、このフィルターにはポータルで作成されたタグのみが一覧表示されます。API のみで設定されたタグはデバイスに割り当てられ、デバイス ページで表示されますが、 **は** 単独ではタグ フィルターには表示されません。

除外タグを表示可能にし、 [Defender Device Inventory](https://security.microsoft.com/machines)でフィルターに使用できるようにするには、少なくとも 1 台のクライアントに対してポータルから手動で一度タグを付ける必要があります（デバイスを選択 > **タグの管理** >「新しいタグの作成」を選び、まったく同じタグ値を使用します）。この一度限りの手順の後、タグは既知のフィルター可能なタグとなり、この runbook で大規模にデバイスへ適用できます。

> **注:** このタグは単なるラベルであり、デバイスのネイティブな除外状態を設定するものではなく、それ自体に修復効果はありません。Defender デバイス グループまたは自動化ルールがこのタグ値に一致するよう明示的に構成されている場合にのみ有効になります。このようなルールはタグ値をポータルの **タグ** フィルターとは独立して直接一致させるため、一度だけの手動手順は、ポータル UI でそのタグをフィルター選択できるかどうかにのみ影響します。

参照 [デバイス タグの作成と管理](https://learn.microsoft.com/defender-endpoint/machine-tags#create-tags) 詳細はこちら。

### 場所

デバイス → 全般 → デバイスを廃止

**完全な Runbook 名**

rjgit-device\_general\_outphase-device

### 詳細

| プロパティ    | 値                                   |
| -------- | ----------------------------------- |
| バージョン    | 1.0.1                               |
| 必須モジュール  | RealmJoin.RunbookHelper (>= 0.8.10) |
| スケジュール可能 | いいえ                                 |

### アクセス許可

#### アプリケーションのアクセス許可

* **型**: Microsoft Graph
  * DeviceManagementManagedDevices.PrivilegedOperations.All
    * *消去オプションが選択されたときに、Intune の消去アクションを実行します*
  * DeviceManagementManagedDevices.ReadWrite.All
    * *azureADDeviceId で Intune デバイスを検索し、removeIntuneDevice が設定されている場合は削除します*
  * DeviceManagementServiceConfig.ReadWrite.All
    * *removeAutopilotDevice が設定されている場合、Autopilot ID を検索して削除します*
  * Device.Read.All
    * *Entra デバイスを解決し、ステータス出力用に登録済みの所有者を読み取ります*
* **型**: WindowsDefenderATP
  * Machine.Read.All
    * *excludeFromDefender が有効な場合、デバイスを Microsoft Defender for Endpoint で検索します*
  * Machine.ReadWrite.All
    * *excludeFromDefender が有効な場合に /machines/{id}/tags を介して除外タグを追加します*

#### RBAC ロール

* クラウド デバイス管理者
  * &#x20;*/devices/{id} を通じて Entra デバイス オブジェクトを無効化および削除するために必要です*

### パラメーター

#### DeviceId

この runbook が対象とするデバイスの Entra ID デバイス ID。ポータルによって、選択したデバイスから設定されます。

| プロパティ    | 値                        |
| -------- | ------------------------ |
| 必須       | true                     |
| 既定値      |                          |
| 型        | 文字列                      |
| ポータルで非表示 | はい（runbook のカスタマイズで事前設定） |

#### intuneAction

完全消去ではデバイス上のすべてのユーザー データと登録データが消去されます。Intune からの削除は、すでに消去または破棄されたデバイスについて、デバイス レコードのみを削除します。消去しない、または削除しない場合は Intune は変更されません。

| プロパティ    | 値          |
| -------- | ---------- |
| 必須       | false      |
| 既定値      | 2          |
| 型        | Int32      |
| ポータルの表示名 | Intune の操作 |

**ポータル オプション**

| ポータル オプション                                    | 値 |
| --------------------------------------------- | - |
| デバイスを完全にワイプする（ユーザー データや登録データは保持しない）           | 2 |
| Intune からデバイスを削除する（デバイスがすでにワイプ済みまたは破棄済みの場合のみ） | 1 |
| デバイスをワイプせず、Intune からも削除しない                    | 0 |

#### aadAction

Delete はデバイス オブジェクトを Entra ID から削除し、Disable は保持したままそのデバイスからのサインインをブロックし、Keep は Entra ID を変更しません。

| プロパティ    | 値               |
| -------- | --------------- |
| 必須       | false           |
| 既定値      | 2               |
| 型        | Int32           |
| ポータルの表示名 | Entra ID オブジェクト |

**ポータル オプション**

| ポータル オプション           | 値 |
| -------------------- | - |
| Entra ID でデバイスを削除する  | 2 |
| Entra ID でデバイスを無効化する | 1 |
| Entra ID のデバイスを保持する  | 0 |

#### wipeDevice

互換性のために残されている旧式のスイッチです。「Intune アクション」での選択によって、デバイスを消去するかどうかが決まります。

| プロパティ    | 値                        |
| -------- | ------------------------ |
| 必須       | false                    |
| 既定値      | True                     |
| 型        | ブール値                     |
| ポータルで非表示 | はい（runbook のカスタマイズで事前設定） |

#### removeIntuneDevice

互換性のために残されている旧式のスイッチです。「Intune アクション」での選択によって、Intune レコードを削除するかどうかが決まります。

| プロパティ    | 値                        |
| -------- | ------------------------ |
| 必須       | false                    |
| 既定値      | False                    |
| 型        | ブール値                     |
| ポータルで非表示 | はい（runbook のカスタマイズで事前設定） |

#### removeAutopilotDevice

Autopilot データベースからデバイスを削除すると、Tenant から離れて別の場所に登録できます。保持しておくと、この Tenant で後から再展開できます。

| プロパティ    | 値                              |
| -------- | ------------------------------ |
| 必須       | false                          |
| 既定値      | True                           |
| 型        | ブール値                           |
| ポータルの表示名 | Autopilot データベースからデバイスを削除しますか? |

**ポータル オプション**

| ポータル オプション                             | 値     |
| -------------------------------------- | ----- |
| Autopilot から削除する（デバイスは Tenant を離れられます） | true  |
| デバイスを Autopilot に保持する                  | false |

#### removeAADDevice

互換性のために残されている旧式のスイッチです。「Entra ID オブジェクト」での選択によって、Entra ID オブジェクトを削除するかどうかが決まります。

| プロパティ    | 値                        |
| -------- | ------------------------ |
| 必須       | false                    |
| 既定値      | True                     |
| 型        | ブール値                     |
| ポータルで非表示 | はい（runbook のカスタマイズで事前設定） |

#### disableAADDevice

互換性のために残されている旧式のスイッチです。「Entra ID オブジェクト」での選択によって、Entra ID オブジェクトを無効化するかどうかが決まります。

| プロパティ    | 値                        |
| -------- | ------------------------ |
| 必須       | false                    |
| 既定値      | False                    |
| 型        | ブール値                     |
| ポータルで非表示 | はい（runbook のカスタマイズで事前設定） |

#### excludeFromDefender

除外タグを使用して Microsoft Defender for Endpoint でデバイスにタグを付けるため、そのタグを使用するルールが自動修復の対象から除外できます。スキップすると Microsoft Defender for Endpoint は変更されません。

| プロパティ    | 値                                     |
| -------- | ------------------------------------- |
| 必須       | false                                 |
| 既定値      | False                                 |
| 型        | ブール値                                  |
| ポータルの表示名 | Defender for Endpoint で除外としてタグ付けしますか? |

**ポータル オプション**

| ポータル オプション                                        | 値     |
| ------------------------------------------------- | ----- |
| Microsoft Defender for Endpoint でデバイスを除外済みとしてタグ付け | true  |
| Defender の操作をスキップする                               | false |

#### defenderExclusionTag

除外ルールで使用するため、Microsoft Defender for Endpoint のデバイスに書き込まれるタグ名。

| プロパティ    | 値                      |
| -------- | ---------------------- |
| 必須       | false                  |
| 既定値      | ExcludeFromRemediation |
| 型        | 文字列                    |
| ポータルの表示名 | Defender の除外タグ         |

[Runbook リファレンスの概要に戻る](https://docs.realmjoin.com/ja/zi-dong-hua/runbooks/runbook-references.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://docs.realmjoin.com/ja/zi-dong-hua/runbooks/runbook-references/device/general/outphase-device.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.
