> 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 モジュール セクションは、以下に基づいて自動的に更新されます [公開リポジトリ](https://github.com/realmjoin/realmjoin-runbooks).
{% endhint %}

上で利用可能な共有 runbook [GitHub](https://github.com/realmjoin/realmjoin-runbooks) 以下の Windows PowerShell モジュールを期待/使用します：

| モジュール                            | runbook 内の最小バージョン |
| -------------------------------- | ----------------- |
| `Az.Accounts`                    | 5.5.2             |
| `Az.Compute`                     | 11.8.0            |
| `Az.DesktopVirtualization`       | 6.0.0             |
| `Az.ManagementPartner`           | 0.8.0             |
| `Az.Storage`                     | 9.7.2             |
| `ExchangeOnlineManagement`       | 3.9.2             |
| `Microsoft.Graph.Authentication` | 2.39.0            |
| `MicrosoftTeams`                 | 7.9.0             |
| `RealmJoin.RunbookHelper`        | 0.8.9             |

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

## アクセス許可

{% 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 に割り当ててください

* アプリケーション開発者
* Cloud Device Administrator
* 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`
* `ServiceHealth.Read.All`
* `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 アカウントに代わるものです。

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

{% hint style="warning" %}
Managed Identity と RunAs アカウントが同時に構成されている場合、RealmJoin の共有リポジトリの runbook は、サポート対象の `RealmJoin.RunbookHelper` モジュールの v0.8.0 以降の新しいバージョンでは、Managed Identity の使用を自動的に優先します。

古いバージョンのモジュールでは Managed Identity を十分に活用できず、RunAs アカウントが優先されていました。

必要な権限を Managed Identity に付与するか、完全に無効化して RunAs アカウントのみを使用するようにしてください。
{% endhint %}

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

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

必要であれば、ClientID と Secret は Azure Automation Account 内の「realmjoin-automation-cred」という名前のマネージド資格情報に保存できます。

現在、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.
