Skip to main content

πŸ“ 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​

Our Metadata​

  • Policy Type: COMPLIANCE_POLICY
  • Policy Category:
    • COST
    • PERFORMANCE

Logic​

Description​

Open File

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​

Open File

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​

Open File

Linked Framework Sections​

SectionSub SectionsInternal RulesPoliciesFlags
πŸ’Ό Cloudaware Framework β†’ πŸ’Ό Waste Reduction9
πŸ’Ό Cloudaware Framework β†’ πŸ’Ό Workload Efficiency6