> 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 にはネイティブの **除外状態** （デバイス インベントリ フィルターでは *除外済み* / *非除外*と表示されます）。この状態は Defender ポータルでのみ設定できます。 **API はありません** デバイスのネイティブな除外状態をプログラムで設定するための。

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

#### 1 回限りの設定: タグをフィルター可能にする

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

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

> **注意:** このタグは単なるラベルであり、デバイスのネイティブな除外状態は設定されず、単独では修復効果もありません。Defender のデバイス グループまたは自動化ルールがこのタグ値に一致するよう明示的に構成されている場合にのみ有効です。このようなルールはポータルの **Tags** フィルターとは独立してタグ値そのものに一致するため、1 回限りの手動手順は、ポータル 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 が有効な場合、Defender for Endpoint でデバイスを検索します*
  * Machine.ReadWrite.All
    * *excludeFromDefender が有効な場合、/machines/{id}/tags を介して除外タグを追加します*

#### RBAC ロール

* Cloud Device Administrator
  * */devices/{id} 経由で Entra ID デバイス オブジェクトを無効化および削除するために必要です*

### パラメーター

#### 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 でデバイスにタグを付けるため、そのタグを使用するルールは自動修復から除外できます。Skip は Defender に変更を加えません。

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

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

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

#### defenderExclusionTag

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

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

[Runbook リファレンスの概要に戻る](/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.
