The Power of PowerShell: Calculating Azure VMware Solution (AVS) Costs

Share on:

Gone are the days of manual calculations and complex spreadsheets to estimate costs. With the capabilities of PowerShell and automation tools we have the ability to streamline the collection of data. Through this blog I will guide you through the steps of utilizing PowerShell to calculate Azure VMware Solution costs.

Introduction to Retreiving Azure Costs

When trying to collect azure costs, you will usually start with the Azure Pricing Calculator this allows you to pick an Azure Service, Region and Amount and it gives you the cost. However sometimes using the web portal can be timely when you just want to pull down a cost for a region quickly.

Alongside the user interface, Azure also has a Retail Prices API. I oiginally planned to use this for my example, but had already used a different method in the past and trying to navigate through the pagination was a built difficult, so in the future I may revisit this script.

Building a Script to Collect Azure Costs

With that being said, I opted to take a “legacy” approach to grabbing the overall costs for an AVS solution. The code snippet is below, but the structure of the script is as follows:

  1. Calculate 730 hours per Month
  2. Pull down AVS Pricing from
  3. Parse it, make it pretty and format it.

Running the Script

All it takes is running the script with the parameters for Region and Number of nodes and you will see the output of the nodes that are available in that region and the On-Demand, 1 Year Reserve and 3 Year Reserve Pricing.

1./getavsCost.ps1 -region us-central -NumberofNodes 1

In this case we can see the cost for the AV36P in us-east. It is the only node type available and matches the price above we recieved from the Azure Cost UI.

In regions that support multiple nodes, you will see the pricing as well.


In closing, costs can vary from region to region and node type to node type. Its important to be easily able to pull down a cost when needed in a format that is automated.

Interested in another solutions cost? Let me know!

comments powered by Disqus

See Also