This is a really nice feature – the Azure Pricing REST-API:
https://docs.microsoft.com/en-us/rest/api/cost-management/retail-prices/azure-retail-prices
It pulls a structured JSON-Dataset for (not only) Virtual Machines out of the Azure-Webshop.
For example – the following filter:
https://prices.azure.com/api/retail/prices?$filter=serviceName eq ‚Virtual Machines‘ and priceType eq ‚Consumption‘ and endswith(armRegionName, ‚europe‘) and (startswith(skuName, ‚D‘) or startswith(skuName, ‚E‘) or startswith(skuName, ‚F‘) or startswith(skuName, ‚M‘)) and endswith(skuName,‘ Spot‘)
displays the price for only
- „VMs“
with specific properties:
- no Reservation
- in „.*europe“-Locations
- with Types „D.*“ or „E.*“ or „F.*“ or „M.*“
- Spot-Intances
but – if you don’t want „Spot“ Instances, you’d guess this filter-Statement: https://prices.azure.com/api/retail/prices?$filter=serviceName eq ‚Virtual Machines‘ and priceType eq ‚Consumption‘ and endswith(armRegionName, ‚europe‘) and (startswith(skuName, ‚D‘) or startswith(skuName, ‚E‘) or startswith(skuName, ‚F‘) or startswith(skuName, ‚M‘)) and not endswith(skuName,‘ Spot‘)
to end with … and not endswith(skuName,‘ Spot‘) according to https://docs.microsoft.com/en-us/azure/search/search-query-odata-logical-operators but this breaks the call – the API returns :
{"Error":{"Code":"BadRequest","Message":"Invalid OData parameters supplied"}}