Azure VM Rightsizing - Validating Current Cost field
search cancel

Azure VM Rightsizing - Validating Current Cost field

book

Article ID: 370687

calendar_today

Updated On:

Products

CloudHealth

Issue/Introduction

Under Azure VM Rightsizing when using the "Actual Price" - cost type the current cost for a Virtual Machine is returned from the tool as if it had run for the entire month. 

This figure won't align with reporting for the Individual VM, but the formula does use inputs from current reporting.

Resolution

To validate the figure you can utilize the following formula:

Compute Cost - Pulled from Usage -> ARM Virtual Machine Hours Report -> Compute Cost field.
Amortized Cost - Pulled from Usage -> ARM Virtual Machine Hours Report -> Amortized Cost field.

Total Hours =  Pulled from Usage -> ARM Virtual Machine Hours Report -> Total Hours field.

Days passed in current month - This is calculated in UTC for AMER and EMEA this should align with the current day, for APAC this will be current day - 1.
Days passed in current month in hours - 24*Days passed in current month. 
Number of days in the current month in hours = Determined by current month, will normally sit around 744, or 720 for most months bar February which will be 672, or 696 in a leap year.

estimatedHoursCalculation = (totalHours/daysPassedInCurrentMonthInHours) * numberOFDaysInCurrentMonthInHours - Estimates based off of current run time how long the VM will run across the entire month.

current cost per hour = (computeCost + amortizedCost) / totalHours - Determines the hourly cost of the virtual machine including amortization of discount methods.  
current cost = (computeCostPerHour * estimatedHoursCalculation) - This final calculation will align with the Current Cost field, and takes the current cost per hour and expands it across the estimate of usage for the VM within the current month.