π Azure Virtual Machine is idle π’
- Contextual name: π Virtual Machine is idle π’
- ID:
/ce/ca/azure/virtual-machine/virtual-machine-idle
- Located in: π Azure Virtual Machine
Flagsβ
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
Our Metadataβ
- Policy Type:
COMPLIANCE_POLICY
- Policy Category:
COST
PERFORMANCE
Logicβ
- π§ prod.logic.yaml π’
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 |
---|---|---|---|---|
πΌ Cloudaware Framework β πΌ Waste Reduction | 9 | |||
πΌ Cloudaware Framework β πΌ Workload Efficiency | 6 |