> 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 %}

で利用できる共有 Runbooks は [GitHub](https://github.com/realmjoin/realmjoin-runbooks) 以下の Windows PowerShell モジュールを想定/使用します:

| モジュール                            | Runbooks における最小バージョン |
| -------------------------------- | -------------------- |
| `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.37.0               |
| `MicrosoftTeams`                 | 7.6.0                |
| `RealmJoin.RunbookHelper`        | 0.8.6                |

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

## アクセス許可

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

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

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

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

### Entra ID ロール

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

* アプリケーション開発者
* Cloud Device Administrator
* Exchange 管理者
* Teams 管理者
* ユーザー管理者

### Graph API 権限

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

* `Application.Read.All`
* `Application.ReadWrite.OwnedBy`
* `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.Read.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`
* `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 リソース権限

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

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

## 認証方法

### マネージド ID

Azure Automation は [マネージド ID](https://docs.microsoft.com/en-us/azure/automation/enable-managed-identity-for-automation) （system assigned）を認証の主な方法としてサポートしています。これは、非推奨の RunAs Accounts に代わるものです。

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

{% hint style="warning" %}
Managed Identity と RunAs Account が同時に構成されている場合、RealmJoin の共有リポジトリにある runbooks は、サポート用 `RealmJoin.RunbookHelper` Module の v0.8.0 以降で、より新しいバージョンを使用する際には、Managed Identity の使用を自動的に優先します。

古いバージョンの Module では Managed Identity を完全に活用できず、RunAs Account が優先されていました。

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

### Client Secret

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

必要であれば、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:

```
GET https://docs.realmjoin.com/ja/zi-dong-hua/connecting-azure-automation/azure-ad-roles-and-permissions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
