feat(query): implements "Beta - VM Without Managed Disk"#7856
Merged
cx-artur-ribeiro merged 15 commits intoDec 15, 2025
Merged
Conversation
Contributor
…tilizing_managed_disks
…20685_61_ensure_virtua_machines_are_utilizing_managed_disks
…ged_disks' of https://github.com/Checkmarx/kics into AST-120685_61_ensure_virtua_machines_are_utilizing_managed_disks
…tilizing_managed_disks
…tilizing_managed_disks
…ged_disks' of https://github.com/Checkmarx/kics into AST-120685_61_ensure_virtua_machines_are_utilizing_managed_disks
…tilizing_managed_disks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Reason for Proposed Changes
Currently there is no query to ensure that resources of type "azurerm_virtual_machine", "azurerm_linux_virtual_machine", "azurerm_windows_virtual_machine" and "azurerm_virtual_machine_scale_set" are utilizing Managed Disks.
Quoting CIS_Microsoft_Azure_Compute_Services_Benchmark_v2.0.0 page 307: "
Managed disks are by default encrypted on the underlying hardware, so no additional encryption is required for basic protection. It is available if additional encryption is required. Managed disks are by design more resilient that storage accounts. For ARM-deployed Virtual Machines, Azure Adviser will at some point recommend moving VHDs to managed disks both from a security and cost management perspective.".Proposed Changes
Implemented the missing query.
The query will flag legacy "
azurerm_virtual_machine" resources if :For "
azurerm_linux_virtual_machine" and "azurerm_windows_virtual_machine" resources it is simply checked that "os_managed_disk_id" field is undefined.Finally for the "
azurerm_virtual_machine_scale_set" resource type, it is checked that thestorage_profile_os_disk.managed_disk_typefield is set. The existence of this field should imply that "vhd_containers" and/or "image" are not set.Note - The query "VM Not Attached To Network" only checks for "azurerm_virtual_machine" resources when it should likely check for all 3 VM resources.
I submit this contribution under the Apache-2.0 license.