> 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/connecting-azure-automation/azure-ad-roles-and-permissions.md).

# Runbook 実行要件

## PowerShell モジュール

{% hint style="info" %}
PowerShell Modules セクションは、次に基づいて自動的に更新されます [公開リポジトリ](https://github.com/realmjoin/realmjoin-runbooks).
{% endhint %}

で利用可能な共有 runbook は [GitHub](https://github.com/realmjoin/realmjoin-runbooks) 次の Windows PowerShell モジュールの使用を想定しています:

| モジュール                            | runbook 内の最小バージョン |
| -------------------------------- | ----------------- |
| `Az.Accounts`                    | 5.5.0             |
| `Az.Compute`                     | 5.1.1             |
| `Az.DesktopVirtualization`       | 5.4.1             |
| `Az.ManagementPartner`           | 0.7.5             |
| `Az.Resources`                   | 9.0.1             |
| `Az.Storage`                     | 9.6.0             |
| `ExchangeOnlineManagement`       | 3.9.2             |
| `Microsoft.Graph.Authentication` | 2.38.0            |
| `MicrosoftTeams`                 | 7.6.0             |
| `RealmJoin.RunbookHelper`        | 0.8.7             |

RealmJoin Portal は、runbook 内から参照されると、これらのモジュールを自動的にインポートしてインストールします。このインポートでは、モジュールに指定された最小バージョンも考慮されます。

## 権限

{% hint style="info" %}
権限セクションは、次に基づいて自動的に更新されます [公開リポジトリ](https://github.com/realmjoin/realmjoin-runbooks).
{% endhint %}

RealmJoin の共有 runbook は、Azure Automation の [システム割り当てマネージド ID](https://learn.microsoft.com/en-us/azure/automation/enable-managed-identity-for-automation) を使用して、Entra ID、MS Graph API などと連携します。

次のロールと権限の一覧により、共有リポジトリで現在利用可能なすべての runbook を使用できるようになります。

runbook はこの権限セットに対してのみテストされているため、これらのロール/権限を減らすことは推奨されません。ロール/権限のセットを減らすと、一部の runbook は動作しなくなります。

### Entra ID ロール

次の Entra ID ロールをマネージド ID に割り当ててください

* アプリケーション開発者
* クラウド デバイス管理者
* Exchange 管理者
* Intune 管理者
* Teams 管理者
* ユーザー管理者

### Graph API の権限

次の Graph API の権限をマネージド ID に付与してください

* `Application.ReadWrite.All`
* `Application.ReadWrite.OwnedBy`
* `AppRoleAssignment.ReadWrite.All`
* `AuditLog.Read.All`
* `BitlockerKey.Read.All`
* `Channel.ReadBasic.All`
* `ChannelMember.ReadWrite.All`
* `CloudPC.ReadWrite.All`
* `Device.ReadWrite.All`
* `DeviceLocalCredential.Read.All`
* `DeviceManagementApps.ReadWrite.All`
* `DeviceManagementConfiguration.ReadWrite.All`
* `DeviceManagementManagedDevices.PrivilegedOperations.All`
* `DeviceManagementManagedDevices.ReadWrite.All`
* `DeviceManagementServiceConfig.ReadWrite.All`
* `Directory.ReadWrite.All`
* `Group.Create`
* `Group.ReadWrite.All`
* `GroupMember.ReadWrite.All`
* `IdentityRiskyUser.ReadWrite.All`
* `InformationProtectionPolicy.Read.All`
* `Mail.Send`
* `Organization.Read.All`
* `Place.Read.All`
* `Policy.Read.All`
* `Reports.Read.All`
* `ReportSettings.ReadWrite.All`
* `RoleAssignmentSchedule.Read.Directory`
* `RoleManagement.Read.All`
* `RoleManagement.Read.Directory`
* `Team.Create`
* `TeamMember.ReadWrite.All`
* `TeamSettings.ReadWrite.All`
* `User.ReadWrite.All`
* `UserAuthenticationMethod.ReadWrite.All`
* `WindowsUpdates.ReadWrite.All`

### その他のアプリ API の権限

次の Office 365 Exchange Online API の権限をマネージド ID に付与してください

* `Exchange.ManageAsApp`

次の WindowsDefenderATP API の権限をマネージド ID に付与してください

* `Machine.Read.All`
* `Machine.Isolate`
* `Machine.RestrictExecution`
* `Ti.ReadWrite.All`

次の SharePoint API の権限をマネージド ID に付与してください

* `User.Read.All`
* `Sites.Read.All`
* `Sites.FullControl.All`

### ロールと権限の付与

マネージド ID に権限を付与することは、現時点では Azure Portal を使用して行えません。これには MS Graph / PowerShell スクリプトの使用を推奨します。

この手順の例を [こちらで](https://github.com/Workplace-Foundation/approle-and-directoryrole-granter).

### Azure リソースの権限

runbook 用の Azure Automation Account をホストしているサブスクリプションまたはリソース グループに、少なくとも「Contributor」アクセスを付与してください

一部の runbook は、レポートやバックアップを保存するために Azure Storage Account を使用します。対応するサブスクリプションまたはリソース グループに、少なくとも「Contributor」アクセスを付与してください。そうすると、ほとんどの runbook はそのリソース グループ内に自分でリソースを作成できます。

## 認証方法

### マネージド ID

Azure Automation は [マネージド ID](https://docs.microsoft.com/en-us/azure/automation/enable-managed-identity-for-automation) (システム割り当て) を認証の主な方法としてサポートしています。これは非推奨の RunAs Accounts に置き換わるものです。

RealmJoin Runbooks は、マネージド ID が構成されていない場合に限り、現在 RunAs Accounts をサポートしています。

{% hint style="warning" %}
マネージド ID と RunAs Account が同時に構成されている場合、RealmJoin の共有リポジトリの runbook は、サポート用の新しいバージョンの `RealmJoin.RunbookHelper` モジュール v0.8.0 以降を使用するとき、既定でマネージド ID の使用を優先します。

古いバージョンのモジュールでは、マネージド ID を十分に活用できず、RunAs Account が優先されていました。

必要な権限をマネージド ID に付与するか、完全に無効にして RunAs Account のみを使用するようにしてください。
{% endhint %}

### クライアント シークレット

一部のプライベート runbook では、ClientID/Secret 形式の認証が必要な場合があります。現在、ClientID と Secret を必要とする共有 runbook はありません。

必要に応じて、ClientID と Secret を Azure Automation Account の "realmjoin-automation-cred" という名前の managed credentials に保存できます。

現在、automation account 内の "realmjoin-automation-cred" は既定で RJ-Wizard により作成されますが、ランダムな値が設定されています。正しい値を入力する必要があります。


---

# 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/connecting-azure-automation/azure-ad-roles-and-permissions.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.
