0

Background: I'm trying to build an app for internal use to display prices for Azure Virtual Machines based on certain criteria, e.g. I want to specify that I require a VM with 4GB of ram, and then look up which VM sizes match that basic criteria, and the display the prices, i'll be comparing this data against other data we have internally for on-prem options.

This all needs to be our EA specific pricing so i can't use the anonymous retail pricing api.

Now, I can pull our EA specific pricesheet from the consumption > priceshet API documented at https://learn.microsoft.com/en-us/rest/api/consumption/pricesheet/get

This which will give me EA specific price details and a 'partNumber' such as 'aad-12345' and also a 'meterName' such as 'D2s v3' and also a 'meterid' which is a guid, but it does not include any further VM details like memory vCPUs etc.

That's fine, because I can pull Compute SKU data from the resource SKUs api documented here https://learn.microsoft.com/en-us/rest/api/compute/resourceskus/list

This will give me the specs for a virtual machine, including memory, vCPUs etc and also it will give me a 'size' property which roughly matches the 'meterName' property from the first API I mentioned above, but its not an exact match, for example, the SKU API will list the size as 'D2s_v3' and the consumption API will list a metername as 'D2s v3'. If that were consistent then perhaps I could make it work bu just replacing spaces with underscores or vice versa but I tried that and there are 80+ sizes in the sku output which dont match the pricesheet sizes if i follow this kind of matching process.

I'm looking for some unqiue identifier to cross reference these data sets or some technique for finding a match. I note that there is a 'meterId' property referenced in the sku api doco https://learn.microsoft.com/en-us/rest/api/compute/resourceskus/list#resourceskucosts - it would be great if i could use this if it matched the meterid in the pricesheet api, but i cannot get the sku api to return the meter id - is this possible?

dpravo
  • 13
  • 2
  • Do you want to estimate the price of a certain size VM? – Jim Xu Jan 19 '21 at 02:03
  • Yes that is one of the objectives, but I do not want to rely on knowing the VM size names like 'D2s_v3' - that value is in the output from the pricsheet api - I can look that up easily. What I want to do is look up the price of a VM with 32GB of memory and 8 vCPUs, for example - you can't do that with just the pricesheet data, because the pricesheet data does nto contain VM specs, thats why I am looking for a way to link the output from the resource sku api (which does have specs) to the pricesheet api output - I cant find an accurate way of doing it without a lot of trial and error. – dpravo Jan 21 '21 at 12:45
  • Hey @dpravo, I am having the same problem as you have, So did you get the information regarding linking the SKU API data with pricesheet meter data? If yes, can you please share it? Thanks – viks Mar 03 '21 at 06:48
  • Hi @viks, I ended up writing a Powershell script which has a bunch of matching logic, which pulls data from both APIs and then consolidates it into a format which is just about useful to me. I just tried to type out the logic I used but its a bit convoluted and I am struggling to convey it in plain English.I just popped it up on GitHub if want to take a look: https://github.com/dpravo/AzVmPriceData hope this helps in some way! – dpravo Mar 04 '21 at 16:02
  • Thank you @dpravo. Will check the above GitHub link. – viks Mar 08 '21 at 08:05

0 Answers0