> 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": []
      }
    ]
  }
}
```

クリックします **Save**.
{% 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.aikido.dev/docs/docs-ja/mashinsukyan/azure-virtual-machine-scanning-setup.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
