⭐ Repository → 📁 Compliance Engine → 📁 CloudAware → 📁 Azure → 📁 Virtual Machine
🛡️ Azure Virtual Machine is idle🟢
- Contextual name: 🛡️ Virtual Machine is idle🟢
- ID:
/ce/ca/azure/virtual-machine/virtual-machine-idle
- Tags:
- Policy Type:
COMPLIANCE_POLICY
- Policy Categories:
COST
,PERFORMANCE
Logic
Description
Description
Identify Azure Virtual Machines with minimal activity over the past 14 days and address them to reduce unnecessary costs. VMs are classified as idle if they meet all the following criteria:
- Average CPU utilization below 5%
- Maximum CPU utilization below 15%
- Average network I/O less than 100 MB
Rationale
Idle Azure VMs continue to consume compute and network resources, resulting in unnecessary operational expenses. Incorporating a threshold for maximum CPU utilization ensures that VMs with brief, transient workloads are not misclassified as idle. This enhanced detection methodology balances cost efficiency with service continuity, enabling more precise identification of optimization opportunities. Proactively managing idle VMs contributes to reduced waste and improved overall performance of the Azure infrastructure.
Audit
This policy evaluates an Azure Virtual Machine based on its 14-day performance metrics.
The VM is marked as
INCOMPLIANT
if all the following criteria are met:
CPU Utilization, Average, %
field is less than 5%.... see more
Remediation
Remediation
Decommissioning Idle Virtual Machines
If a VM is no longer required or its workload has been migrated, consider the following actions to eliminate unnecessary resource costs:
Stopping (Deallocating) the VM
This action stops the VM and releases compute resources. Billing for compute is paused, but charges for persistent resources (e.g., OS and data disks, reserved IPs) continue.
Azure CLI
az vm deallocate --resource-group {{resource-group-name}} --name {{vm-name}}
PowerShell
Stop-AzVM -ResourceGroupName "{{resource-group-name}}" -Name "{{vm-name}}"
Terminating (Deleting) the VM
This permanently deletes the VM. Use caution—ensure data has been fully migrated or backed up prior to deletion.
To preserve the disk for future reuse, configure the OS disk's delete option to "detach":
az resource update
--resource-group {{resource-group-name}} \
--name {{vm-name}} \
--resource-type virtualMachines \
--namespace Microsoft.Compute \
--set properties.storageProfile.osDisk.deleteOption=detach
... [see more](remediation.md)
policy.yaml
Linked Framework Sections
Section | Sub Sections | Internal Rules | Policies | Flags | Compliance |
---|---|---|---|---|---|
💼 Cloudaware Framework → 💼 Waste Reduction | 25 | no data | |||
💼 Cloudaware Framework → 💼 Workload Efficiency | 24 | no data |