Azure Virtual Machine Scanning Setup
This functionality is available for Pro and Advanced plans only. Contact us for more information.
Why should I scan my virtual machines?
With virtual machine scanning, Aikido scans the disks of your virtual machines for vulnerable packages and outdated runtimes.
Prerequisites
You'll need an Entra ID app registration with a client secret. If you've already connected your Azure cloud to Aikido for cloud scanning, you can reuse that same app registration, no need to create a new one. Otherwise, set that up first via Connect your Azure cloud.
Create a custom role
Aikido uses a custom Azure role scoped to the minimum permissions needed to scan your virtual machines.
Go to Access control (IAM)
Navigate to Subscriptions (or your management group), find the relevant scope for your virtual machines, and click Access control (IAM).
Add a custom role
Click Add, then Add custom role.
Choose your scope
Decide whether the role should be assignable at subscription level or management group level:
- Single subscription: covers VMs in one subscription only.
- Management group: covers all subscriptions underneath it, useful if your VMs are spread across multiple subscriptions.
For management group scope, you don't need to look up a separate ID. Use your Directory (tenant) ID, the same one from your app registration overview page. This maps to your organization's root management group.
Paste the role JSON
Go to the JSON tab and click Edit. Paste the role definition below.
Set
assignableScopesbased on the scope you chose:For a single subscription:
"assignableScopes": [ "/subscriptions/<your-subscription-id>" ]For a management group:
"assignableScopes": [ "/providers/Microsoft.Management/managementGroups/<your-directory-tenant-id>" ]Full role definition:
{ "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": [] } ] } }Click Save.
Review and create
At the bottom, click Review + assign, then Create.
Assign the role to your app registration
Go back to Access control (IAM)
Navigate to the same scope (subscription or management group) and click Access control (IAM).
Add a role assignment
Go to the Role assignments tab, click Add, then Add role assignment.
Select the custom role
In the Role tab, search for and select the Aikido VM Scanner role, then click Next.
Assign it to your app registration
Leave Assign access to on its default value. Click Select members, search for your app registration name (e.g. "AikidoSecurity"), and select it. Click Select, then Review + assign twice.
Your app registration now has the permissions it needs to scan your Azure virtual machines.
VM grouping
To optimize scanning efficiency, Aikido groups certain Azure VMs and scans only one instance from each group. Grouping works as follows:
- Virtual Machine Scale Sets (VMSS): All VMs that belong to the same VMSS are shown as a single VM group in Aikido. The VM group's name matches the VMSS identifier.
- No grouping: VMs that aren't part of a VMSS are treated as standalone VMs and scanned individually.