Lesson 4 of 5 Defender for Servers and Hybrid Security

Implementing Agentless Scanning for VMs

This lesson explains how agentless scanning works, its limits, and what encrypted disks need.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain how agentless scanning works.
  • Identify the plans and schedule.
  • Identify its limits.
  • Grant access for customer-managed key disks.

How it works

Agents have drawbacks. They must be deployed, updated and kept running, and they miss machines on which they fail to install. Agentless scanning takes a different approach. Using cloud APIs, Defender for Cloud takes a snapshot of a VM's disks, analyses the copy in a secure environment, and deletes it. Nothing runs in the guest, no network connection to the machine is needed, and the workload's performance is not affected.

The snapshots are copies of the root and data disks, and they stay in the VM's region, which helps with data residency. They are deleted once metadata has been collected, typically after a few minutes. The scanner looks for installed software, known vulnerabilities, secrets and, with Plan 2, malware.

The following diagram shows the steps of an agentless scan.

Agentless scanning for VMs. Through cloud APIs, Defender for Cloud takes a snapshot of a VM's root and data disks, analyses the copy in a secure environment in the VM's region, and deletes the snapshot once metadata is collected, typically after a few minutes. Nothing runs in the guest and no network connection to the machine is needed. The scan finds installed software, vulnerabilities, secrets and, with Plan 2, malware.
Snapshots stay in the VM's region.

Availability and schedule

Agentless machine scanning is available with Defender CSPM or Defender for Servers Plan 2, and it is enabled by default with Plan 2. It is one switch per connected environment, labelled Agentless scanning for machines. Malware scanning needs Plan 2. A scan runs once every 24 hours, and the schedule is not configurable. Allow up to 24 hours for results after enabling it, or after changing permissions.

The following table shows which results come from which plan.

CapabilityDefender CSPMDefender for Servers Plan 2
Agentless vulnerability assessmentYesYes
Agentless secrets scanningYesYes
Agentless malware scanningNoYes

Limits

A candidate should know why a VM might have no results. The following list gives the documented limits for Azure VMs.

  • If the combined size of OS and data disks is 4 TB or less, all disks are scanned. Above that, only the OS disk is scanned, and only if it is under 4 TB.
  • VMs with more than 14 disks are not supported.
  • Stopped or deallocated VMs are skipped in that cycle.
  • The disk types UltraSSD_LRS and PremiumV2_LRS, and AKS ephemeral OS disks, are not supported, and any such disk excludes the VM.
  • File systems such as UFS, ReFS and ZFS are not supported.
  • Databricks VMs are not supported.

Malware scans can give partial coverage on an archive larger than 1 GB, one with more than 10,000 files, or one with more than five nested levels.

Select all that apply

Why a VM has no results

Exam skills 3.2.7

Identify the limits that stop agentless scanning from covering a VM.

Log in to try this activity Interactive activities are free with an account.

Encrypted disks

Scanning needs to read a snapshot, so the scanner may need key access. Platform-managed keys need nothing. For Azure disks that use a customer-managed key, grant access to the application Microsoft Defender for Cloud Servers Scanner Resource Provider. If the vault uses Azure RBAC, assign Key Vault Crypto Service Encryption User. If it uses access policies, grant Get, Wrap Key and Unwrap Key.

If a vault is behind a firewall, consider how that service reaches it. Scan results for these VMs appear after the next cycle, up to 24 hours later.

Troubleshooting scenario

No results for encrypted VMs

Exam skills 3.2.7

Resolve missing agentless scan results.

Log in to try this activity Interactive activities are free with an account.

AWS and GCP

Agentless scanning also works in other clouds through their connectors. In AWS, it covers EC2 instances and Auto Scaling group instances, including those with unencrypted, platform-managed or customer-managed disks. AMIs that need third-party licensing, such as those from AWS Marketplace, are not supported. Snapshot deletion is limited to snapshots tagged CreatedBy=Microsoft Defender for Cloud. If 250 or more tagged snapshots have failed deletion, new scans are suspended for that scope.

In GCP, it covers Compute Engine instances and instance groups, with Google-managed or customer-managed keys. Organization policies can block scanning, so check them if a project shows no results.

Worked example

No results for one VM

A VM with Plan 2 protection has no agentless findings after a week. It runs continuously, has two Premium SSD data disks of 2 TB each and a 128 GB OS disk, and all disks use a customer-managed key in Key Vault with Azure RBAC. Other VMs in the subscription have results. What is the most likely cause, and what do you do?

The customer-managed key is the likely cause, as this VM differs from the rest in that way. Assign Key Vault Crypto Service Encryption User on the vault to Microsoft Defender for Cloud Servers Scanner Resource Provider, and wait for the next cycle.

A second problem also appears: the combined size is over 4 TB, so only the OS disk would be scanned once key access is granted. The data disks need agent-based coverage from the Defender for Endpoint sensor. Reducing the scan interval is not possible, because the schedule is fixed.

Check yourself

Can a team scan every six hours by changing a setting?

Show answer

No. Scans run once every 24 hours, and the schedule is not configurable.

Exam Tips

Remember for the exam

  • Agentless scanning uses snapshots, which stay in the VM's region.
  • It runs once every 24 hours, and the schedule cannot be changed.
  • Customer-managed key disks need the scanner application to be granted key access.
  • VMs with more than 14 disks are not supported.