Estimated Price API

Amit Kr 0 Reputation points
2023-04-28T12:44:01.8333333+00:00

Hi,

I am writing this as I need your help with the API from which I can fetch the estimated price of VM, license cost with committed discounts.

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
3,578 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SadiqhAhmed-MSFT 49,326 Reputation points Microsoft Employee Moderator
    2023-04-28T21:22:33.5433333+00:00

    To fetch the estimated price of a VM, license cost with committed discounts, you can use the Azure Pricing Calculator API. This API allows you to programmatically retrieve pricing information for Azure services, including virtual machines and software licenses.

    Here's an example of how to use the Azure Pricing Calculator API to retrieve pricing information for a virtual machine:

    First, you need to get an API key for the Azure Pricing Calculator API. You can get the API key by following the instructions in the Azure Pricing Calculator API documentation.

    1. Once you have the API key, you can use it to make a REST API call to the Azure Pricing Calculator API. Here's an example of the API call to retrieve pricing information for a virtual machine:
    GET https://prices.azure.com/api/retail/prices?$filter=serviceName eq 'Virtual Machines' and armSkuName eq 'Standard_D2_v3' and armRegionName eq 'eastus' and priceType eq 'Consumption' and termType eq '1 Year' and includedQuantity eq 1 and isPrimaryMeterRegion eq true and currencyCode eq 'USD' and priceDate eq '2022-01-01T00:00:00Z'&$top=1&$skip=0&$orderby=unitPrice asc&$select=unitPrice
    

    In this example, the API call retrieves pricing information for a Standard_D2_v3 virtual machine in the East US region, with a 1-year commitment and 1 unit of quantity. The API call also specifies that the price should be returned in USD and that the price date is January 1, 2022.

    1. Once you make the API call, you will receive a JSON response that contains the pricing information for the virtual machine. Here's an example of the JSON response:
    {
        "Items": [
            {
                "unitPrice": 0.064
            }
        ]
    }
    

    In this example, the unit price for the virtual machine is $0.064 per hour.

    You can modify the API call to retrieve pricing information for different virtual machine sizes, regions, commitment terms, and quantities. You can also use the API to retrieve pricing information for other Azure services, such as software licenses.

    Hope this helps!


    If the response helped, do "Accept Answer" and up-vote it


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.