> 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).

# Outphase Device

### 説明

Windows デバイスを削除/段階的に廃止します。デバイスをワイプするか、Intune および AutoPilot から削除するかを選択できます。必要に応じて、Microsoft Defender for Endpoint でデバイスにタグを付け、修復の対象外であることを示せます。注意: 除外タグはデバイスに適用されますが、Defender ポータルの「Tags」フィルターに表示されるのは、ポータル経由で一度作成された後だけです (Device > Manage tags > "Create new tag")。

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

Microsoft Defender for Endpoint にはネイティブの **除外状態** (Device Inventory フィルターでは *Excluded* / *Not Excluded*と表示されます)。この状態は Defender ポータルからのみ設定でき、 **API はありません** デバイスのネイティブな除外状態をプログラムで設定することはできません。

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

#### 一度だけのセットアップ: タグをフィルター可能にする

ポータルの **Tags** 残念ながら、このフィルターにはポータル経由で作成されたタグしか一覧表示されません。API のみで設定されたタグはデバイスに付与され、デバイス ページでは表示されますが、 **表示されません** Tags フィルターには自動では表示されません。

除外タグを表示して [Defender Device Inventory](https://security.microsoft.com/machines)でフィルターに使用できるようにするには、1 台のクライアントをポータル経由で一度手動でタグ付けする必要があります (デバイスを選択 > **Manage tags** > "Create new tag"、同じタグ値を正確に使用)。この一度だけの手順の後、タグは既知のフィルター可能なタグとなり、この runbook はそれを大規模にデバイスへ適用できるようになります。

> **注:** このタグは単なるラベルであり、デバイスのネイティブな Exclusion state を設定するものではなく、それ自体に修復効果はありません。効果を持つのは、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.9) |
| スケジュール可能 | いいえ                                |

### アクセス許可

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

* **種類**：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 ロール

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

### パラメーター

#### DeviceId

対象デバイスのデバイス ID。

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

#### intuneAction

実行する Intune アクション (ワイプ、削除、またはなし) を決定します。

| プロパティ   | 値               |
| ------- | --------------- |
| 必須      | いいえ             |
| 既定値     | 2               |
| 種類      | Int32           |
| ポータル表示名 | このデバイスをワイプしますか? |

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

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

#### aadAction

実行する Entra ID (Azure AD) アクション (削除、無効化、またはなし) を決定します。

| プロパティ   | 値                      |
| ------- | ---------------------- |
| 必須      | いいえ                    |
| 既定値     | 2                      |
| 種類      | Int32                  |
| ポータル表示名 | EntraID からデバイスを削除しますか? |

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

| ポータルオプション                  | 値 |
| -------------------------- | - |
| EntraID でデバイスを削除           | 2 |
| EntraID でデバイスを無効化          | 1 |
| EntraID デバイスを削除しない / 気にしない | 0 |

#### wipeDevice

true に設定すると、Intune でワイプ アクションをトリガーします。

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

#### removeIntuneDevice

true に設定すると、Intune デバイス オブジェクトを削除します。

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

#### removeAutopilotDevice

「AutoPilot データベースからデバイスを削除しますか?」(最終値: true) または「デバイスを保持 / 気にしない」(最終値: false) を実行アクションとして選択できます。true に設定すると、runbook は AutoPilot データベースからデバイスを削除し、これによりデバイスは Tenant から離脱できます。false に設定すると、デバイスは AutoPilot データベースに残り、Tenant 内の別のユーザー/デバイスに再割り当てできます。

| プロパティ   | 値                              |
| ------- | ------------------------------ |
| 必須      | いいえ                            |
| 既定値     | はい                             |
| 種類      | ブール値                           |
| ポータル表示名 | AutoPilot データベースからデバイスを削除しますか? |

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

| ポータルオプション                                    | 値   |
| -------------------------------------------- | --- |
| デバイスを AutoPilot から削除する（デバイスがテナントを離れることができます） | はい  |
| デバイスを保持 / どちらでもよい                            | いいえ |

#### removeAADDevice

実行するアクションとして、「EntraID からデバイスを削除しますか?」（最終値: true）または「デバイスを保持 / どちらでもよい」（最終値: false）を選択できます。true に設定すると、runbook は Entra ID (Azure AD) からデバイス オブジェクトを削除します。false に設定すると、デバイス オブジェクトは Entra ID (Azure AD) に残ります。

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

#### disableAADDevice

実行するアクションとして、「EntraID でデバイスを無効にしますか?」（最終値: true）または「デバイスを保持 / どちらでもよい」（最終値: false）を選択できます。true に設定すると、runbook は Entra ID (Azure AD) でデバイス オブジェクトを無効にします。false に設定すると、デバイス オブジェクトは Entra ID (Azure AD) で有効なままになります。

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

#### excludeFromDefender

true に設定すると、デバイスは Microsoft Defender for Endpoint で指定された除外タグでタグ付けされます。false に設定すると、Defender の手順は完全にスキップされます。

| プロパティ   | 値                                                |
| ------- | ------------------------------------------------ |
| 必須      | いいえ                                              |
| 既定値     | False                                            |
| 種類      | ブール値                                             |
| ポータル表示名 | デバイスを Microsoft Defender for Endpoint の対象外にしますか? |

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

| ポータルオプション                                       | 値   |
| ----------------------------------------------- | --- |
| Microsoft Defender for Endpoint でデバイスに対象外タグを付ける | はい  |
| Defender の操作をスキップ                               | いいえ |

#### defenderExclusionTag

Microsoft Defender for Endpoint でデバイスに追加され、除外済みであることを示すタグです。既定値は "ExcludeFromRemediation" です。

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

[Runbook Reference の概要に戻る](/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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.realmjoin.com/ja/zi-dong-hua/runbooks/runbook-references/device/general/outphase-device.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
