Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on Costs cloumn in recommendations for VM scale sets. #1221

Open
sg1234566 opened this issue Dec 17, 2024 · 1 comment
Open

Question on Costs cloumn in recommendations for VM scale sets. #1221

sg1234566 opened this issue Dec 17, 2024 · 1 comment
Assignees
Labels
Tool: Optimization Engine Azure Optimization Engine

Comments

@sg1234566
Copy link

How are costs calculated in VM scale sets recommendations.
Run book - Recommend-VMSSOptimizationsToBlobStorage.
Below is the query in above run book where total costs are calculated.
I see discrepancy in azure costs and query provided by below results for 30 day period.

AzureOptimizationConsumptionV1_CL
where todatetime(Date_s) between (stime..etime) and ResourceId contains 'virtualmachinescalesets'
| extend VMConsumedQuantity = iif(ResourceId contains 'virtualmachinescalesets' and MeterCategory_s == 'Virtual Machines', todouble(Quantity_s), 0.0)
| extend VMPrice = iif(ResourceId contains 'virtualmachinescalesets' and MeterCategory_s == 'Virtual Machines', todouble(EffectivePrice_s), 0.0)
| extend FinalCost = VMPrice * VMConsumedQuantity
| extend InstanceId_s = tolower(ResourceId)
| summarize Last30DaysCost = sum(FinalCost), Last30DaysQuantity = sum(VMConsumedQuantity) by InstanceId_s;

Please find attached cost analysis screenshot at RG level
Screenshot from Recommendations

Image

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Triage 🔍 Untriaged issue needs to be reviewed label Dec 17, 2024
@helderpinto helderpinto self-assigned this Dec 19, 2024
@helderpinto
Copy link
Member

helderpinto commented Dec 19, 2024

Hi, @sg1234566 . AOE calculates VMSS costs based on the consumed quantities (in compute hours) multiplied by the effective hourly price (inclusive of reservations or savings plans discounts). The discrepancy you are seeing might be caused by the fact you are looking at Cost Analysis actual costs (which sums as 0 every hour in which a VM was benefitting from a reservation or savings plans). If you switch to amortized costs (which takes into account the reservation/savings plans cost), you'll probably see a figure closer to what AOE is displaying.

Image

@helderpinto helderpinto added Tool: Optimization Engine Azure Optimization Engine and removed Needs: Triage 🔍 Untriaged issue needs to be reviewed labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tool: Optimization Engine Azure Optimization Engine
Projects
None yet
Development

No branches or pull requests

2 participants