> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/mashinsukyan/azure-virtual-machine-scanning-setup.md).

# Azure仮想マシンスキャンの設定

{% hint style="info" %}
この機能は以下のプランで利用できます **Pro** と **Advanced** プランのみ。 [お問い合わせ](https://www.aikido.dev/contact) 詳細については。
{% endhint %}

### なぜ仮想マシンをスキャンする必要があるのですか？ <a href="#why-should-i-scan-my-virtual-machines" id="why-should-i-scan-my-virtual-machines"></a>

仮想マシンのスキャンでは、Aikido は仮想マシンのハードドライブをスキャンし、脆弱なパッケージ、古いランタイム、リスクのあるライセンスを検出できます。

### 前提条件

クライアント シークレット付きの Entra ID アプリ登録が必要です。すでにクラウドスキャン用に Azure クラウドを Aikido に接続している場合は、その同じアプリ登録を再利用でき、新しいものを作成する必要はありません。そうでない場合は、まず次から設定してください: [Azure クラウドを接続する](https://help.aikido.dev/cloud-scanning/connect-your-cloud/azure/connect-azure-cloud-account-to-aikido).

### カスタム ロールを作成 <a href="#getting-started" id="getting-started"></a>

Aikido は、仮想マシンのスキャンに必要な最小権限に限定したカスタム Azure ロールを使用します。

{% stepper %}
{% step %}

### アクセス制御 (IAM) に移動

移動先 **サブスクリプション** （または **管理グループ**）で、仮想マシンに該当するスコープを見つけ、 **アクセス制御 (IAM)**.
{% endstep %}

{% step %}

### カスタム ロールを追加

クリック **追加**、次に **カスタム ロールを追加**.
{% endstep %}

{% step %}

### スコープを選択

ロールを割り当て可能にする場所を次から選択してください **サブスクリプション レベル** または **管理グループ レベル**:

* **単一サブスクリプション:** 1つのサブスクリプション内の VM のみを対象にします。
* **管理グループ:** 配下のすべてのサブスクリプションを対象にします。VM が複数のサブスクリプションにまたがっている場合に便利です。

{% hint style="info" %}
管理グループ スコープでは、別の ID を調べる必要はありません。次を使用してください: **ディレクトリ（テナント）ID**。これはアプリ登録の概要ページにあるものと同じです。これは組織のルート管理グループに対応します。
{% endhint %}
{% endstep %}

{% step %}

### ロールの JSON を貼り付け

へ移動してください **JSON** タブを開き、 **編集**。以下のロール定義を貼り付けます。

設定する `assignableScopes` 選択したスコープに基づいて:

単一サブスクリプションの場合:

```json
"assignableScopes": [
  "/subscriptions/<your-subscription-id>"
]
```

管理グループの場合:

```json
"assignableScopes": [
  "/providers/Microsoft.Management/managementGroups/<your-directory-tenant-id>"
]
```

完全なロール定義:

```json
{
  "properties": {
    "roleName": "Aikido VM Scanner",
    "description": "",
    "assignableScopes": [
      "<insert scope from above>"
    ],
    "permissions": [
      {
        "actions": [
          "Microsoft.Compute/virtualMachines/read",
          "Microsoft.Compute/disks/beginGetAccess/action",
          "Microsoft.Compute/disks/endGetAccess/action",
          "Microsoft.Compute/disks/read",
          "Microsoft.Compute/snapshots/read",
          "Microsoft.Compute/snapshots/write",
          "Microsoft.Compute/snapshots/delete",
          "Microsoft.Compute/snapshots/beginGetAccess/action",
          "Microsoft.Compute/snapshots/endGetAccess/action",
          "Microsoft.Authorization/roleAssignments/read"
        ],
        "notActions": [],
        "dataActions": [],
        "notDataActions": []
      }
    ]
  }
}
```

クリック **保存**.
{% endstep %}

{% step %}

### 確認して作成

下部で次をクリックします: **確認 + 割り当て**、次に **作成**.
{% endstep %}
{% endstepper %}

### ロールをアプリ登録に割り当てる

{% stepper %}
{% step %}

### アクセス制御 (IAM) に戻る

同じスコープ（サブスクリプションまたは管理グループ）に移動し、次をクリックします。 **アクセス制御 (IAM)**.
{% endstep %}

{% step %}

### ロールの割り当てを追加

へ移動してください **ロールの割り当て** タブで、次をクリックします: **追加**、次に **ロールの割り当てを追加**.
{% endstep %}

{% step %}

### カスタム ロールを選択

で **ロール** タブで、検索して選択します: **Aikido VM Scanner**、次にクリックします **次へ**.
{% endstep %}

{% step %}

### アプリ登録に割り当てます

そのままにします **アクセスの割り当て先** は既定値のままにします。次をクリックします: **メンバーを選択**で、アプリ登録名（例: "AikidoSecurity"）を検索して選択します。次をクリックします: **選択します**、次に **確認 + 割り当て** を2回。
{% endstep %}
{% endstepper %}

{% hint style="info" %}
これで、アプリ登録に Azure 仮想マシンをスキャンするために必要な権限が付与されました。
{% endhint %}

### VM のグループ化

スキャン効率を最適化するため、Aikido は特定の Azure VM をグループ化し、各グループから1つのインスタンスのみをスキャンします。グループ化は次のように動作します:

* **仮想マシン スケール セット (VMSS)**: 同じ VMSS に属するすべての VM は、Aikido では1つの VM グループとして表示されます。VM グループ名は VMSS の識別子と一致します。
* **グループ化なし**: VMSS に属していない VM は、個別のスタンドアロン VM として扱われ、それぞれ個別にスキャンされます。


---

# 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://help.aikido.dev/docs/docs-ja/mashinsukyan/azure-virtual-machine-scanning-setup.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.
