> 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/org/general/add-primary-users-of-devices-to-group_scheduled.md).

# デバイスのプライマリ ユーザーをグループに追加 - 定期実行

{% hint style="info" %}
これはスケジュール実行の runbook です。単一のオブジェクトでトリガーされるのではなく、繰り返しのスケジュールで実行されるように設計されています。参照してください [スケジュール設定](/ja/zi-dong-hua/runbooks/scheduling.md) runbook のスケジュールを構成する方法の詳細について。
{% endhint %}

### 説明

このランブックは、選択したプラットフォームに一致するすべての Intune 管理デバイスのプライマリ ユーザーを収集し、ターゲットの Entra ID グループに同期します。いずれかの一致デバイスでプライマリ ユーザーとして割り当てられなくなったユーザーは、そのグループから削除されます。任意の include グループにより対象ユーザーが制限され、任意の exclude グループにより特定のユーザーが追加されないようにするか、削除された状態を維持します。

### 場所

組織 → 全般 → デバイスのプライマリ ユーザーをグループに追加 (スケジュール済み)

**Runbook の完全名**

rjgit-org\_general\_add-primary-users-of-devices-to-group\_scheduled

### 詳細

| プロパティ    | 値                                                                                       |
| -------- | --------------------------------------------------------------------------------------- |
| バージョン    | 1.1.0                                                                                   |
| 必要なモジュール | <p>RealmJoin.RunbookHelper (>= 0.8.9)<br>Microsoft.Graph.Authentication (>= 2.39.0)</p> |
| スケジュール可能 | はい                                                                                      |

### アクセス許可

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

* **種類**：Microsoft Graph
  * DeviceManagementManagedDevices.Read.All
    * *OS でフィルターされた Intune 管理デバイスを読み取り、各デバイスのプライマリ ユーザーを収集します*
  * Group.Read.All
    * *ターゲット/include/exclude グループを検証し、それぞれのメンバー リストを読み取ります*
  * GroupMember.ReadWrite.All
    * *バッチ化された /groups/{id}/members/$ref 呼び出しを使用して、ターゲット グループのユーザーを追加および削除します*
  * User.Read.All
    * *メンバー ID と UPN を読み取り、ユーザー メンバーを識別して削除をログに記録します*

### パラメーター

#### TargetGroupId

この Entra ID グループにプライマリ ユーザーを同期します。このグループのメンバーは、このランブックによってのみ管理されます。

| プロパティ   | 値                            |
| ------- | ---------------------------- |
| 必須      | はい                           |
| 既定値     |                              |
| 種類      | 文字列                          |
| ポータル表示名 | ターゲット グループ（プライマリ ユーザーを同期する先） |

#### Windows

Windows デバイスのプライマリ ユーザーを含めます。（使用される OData フィルター: "operatingSystem eq 'Windows'"）

| プロパティ   | 値                |
| ------- | ---------------- |
| 必須      | いいえ              |
| 既定値     | False            |
| 種類      | ブール値             |
| ポータル表示名 | Windows デバイスを含める |

#### macOS

macOS デバイスのプライマリ ユーザーを含めます。（使用される OData フィルター: "operatingSystem eq 'macOS'"）

| プロパティ   | 値              |
| ------- | -------------- |
| 必須      | いいえ            |
| 既定値     | False          |
| 種類      | ブール値           |
| ポータル表示名 | macOS デバイスを含める |

#### iOS

iOS および iPadOS デバイスのプライマリ ユーザーを含めます。（使用される OData フィルター: "operatingSystem eq 'iOS'"）

| プロパティ   | 値            |
| ------- | ------------ |
| 必須      | いいえ          |
| 既定値     | False        |
| 種類      | ブール値         |
| ポータル表示名 | iOS デバイスを含める |

#### Android

Android デバイスのプライマリ ユーザーを含めます。（使用される OData フィルター: "operatingSystem eq 'Android'"）

| プロパティ   | 値                |
| ------- | ---------------- |
| 必須      | いいえ              |
| 既定値     | False            |
| 種類      | ブール値             |
| ポータル表示名 | Android デバイスを含める |

#### 詳細フィルター

任意。デバイスの取得時に適用するカスタム OData フィルター。指定した場合、プラットフォーム ベースのフィルターよりも優先されます。例: startsWith(deviceName,'FWP-') and operatingSystem eq 'Windows' 。

| プロパティ   | 値                     |
| ------- | --------------------- |
| 必須      | いいえ                   |
| 既定値     |                       |
| 種類      | 文字列                   |
| ポータル表示名 | カスタム フィルター（OS 選択を上書き） |

#### RemoveUsersWhenNoDeviceMatch

有効にすると（既定）、選択したプラットフォームに一致するプライマリ デバイスをもはや持たないユーザーは、ターゲット グループから削除されます。無効にすると追加のみのモードになり、既存のメンバーは削除されません。

| プロパティ   | 値                       |
| ------- | ----------------------- |
| 必須      | いいえ                     |
| 既定値     | はい                      |
| 種類      | ブール値                    |
| ポータル表示名 | 一致するデバイスがなくなったユーザーを削除する |

#### IncludeGroupId

任意。このグループのメンバーであるユーザーのみが、ターゲット グループへの追加対象になります。すべてのプライマリ ユーザーを対象にする場合は空欄のままにしてください。

| プロパティ    | 値                        |
| -------- | ------------------------ |
| 必須       | いいえ                      |
| 既定値      |                          |
| 種類       | 文字列                      |
| ポータル表示名  | グループからユーザーを含める（任意）       |
| ポータルで非表示 | はい（Runbook のカスタマイズで事前設定） |

#### ExcludeGroupId

任意。このグループのメンバーであるユーザーは追加されず、すでに存在する場合はターゲット グループから削除されます。

| プロパティ    | 値                        |
| -------- | ------------------------ |
| 必須       | いいえ                      |
| 既定値      |                          |
| 種類       | 文字列                      |
| ポータル表示名  | グループからユーザーを除外する（任意）      |
| ポータルで非表示 | はい（Runbook のカスタマイズで事前設定） |

[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/org/general/add-primary-users-of-devices-to-group_scheduled.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.
