feat(query): implements "Beta - VM Without Managed Disk" #7856
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" and "azurerm_windows_virtual_machine" 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.Note - 2 queries that are also related to vm resources exist but both miss resources. The query "VM Not Attached To Network" only checks for "azurerm_virtual_machine" resources while the second query "Azure Instance Using Basic Authentication" checks for "azurerm_virtual_machine" and "azurerm_linux_virtual_machine" but does not check for "azurerm_windows_virtual_machine".
I submit this contribution under the Apache-2.0 license.