Azure Retail Prices overview

Azure customers have been looking for a programmatic way to retrieve retail prices for all Azure services. Now you can use the Retail Rates Prices API to get retail prices for all Azure services. Previously, the only way that you could retrieve prices for Azure services was to either use the Azure Pricing Calculator or use the Azure portal. This API gives you an unauthenticated experience to get retail rates for all Azure services. Use the API to explore prices for Azure services against different regions and different SKUs. The programmatic API can also help you create your own tools for internal analysis and price comparison across SKUs and regions.

Important

The currency that Microsoft uses to price all Azure services is USD. Prices shown in USD currency are Microsoft retail prices. Other non-USD prices returned by the API are for your reference to help you estimate budget expenses.

Preview version

You can use the new 2023-01-01-preview API version at https://prices.azure.com/api/retail/prices?api-version=2023-01-01-preview. The preview version is backward compatible with previous API versions. The URL returns the full set of meters, including primary meters and nonprimary meters.

Using either https://prices.azure.com/api/retail/prices or https://prices.azure.com/api/retail/prices?api-version=2023-01-01-preview returns the full set of meters.

Rates for savings plans are only available with the https://prices.azure.com/api/retail/prices?api-version=2023-01-01-preview version.

Primary meter filtering

You can limit responses to retrieve only primary meter prices with:

https://prices.azure.com/api/retail/prices?api-version=2023-01-01-preview&meterRegion='primary'

Primary meter filtering is supported by 2021-10-01 and later API versions including 2023-01-01.

Filter value is case sensitive

In previous API versions, the filter value wasn't case sensitive. However, in the 2023-01-01-preview version and later, the value is case sensitive.

For example:

https://prices.azure.com/api/retail/prices?$filter=serviceName eq 'Virtual Machines' works.

In earlier API versions, Virtual Machines and virtual machines worked.

Now, only Virtual Machines works.

Azure saving plan support

As previously mentioned, Azure savings plan retail prices are only supported with the preview version (https://prices.azure.com/api/retail/prices?api-version=2023-01-01-preview). For the meters eligible for a savings plan, results have a corresponding section for savings plan. When you commit to a savings plan, you get a cheaper price than the OnDemand price. For more information about Azure savings plans, see Azure savings plans documentation.

Here's an example API response with savings plan information:


        {
            "currencyCode": "USD",
            "tierMinimumUnits": 0.0,
            "retailPrice": 2.305,
            "unitPrice": 2.305,
            "armRegionName": "southindia",
            "location": "IN South",
            "effectiveStartDate": "2019-05-14T00:00:00Z",
            "meterId": "0084b086-37bf-4bee-b27f-6eb0f9ee4954",
            "meterName": "M8ms",
            "productId": "DZH318Z0BQ4W",
            "skuId": "DZH318Z0BQ4W/00BQ",
            "availabilityId": null,
            "productName": "Virtual Machines MS Series",
            "skuName": "M8ms",
            "serviceName": "Virtual Machines",
            "serviceId": "DZH313Z7MMC8",
            "serviceFamily": "Compute",
            "unitOfMeasure": "1 Hour",
            "type": "Consumption",
            "isPrimaryMeterRegion": true,
            "armSkuName": "Standard_M8ms",
            "savingsPlan": [
                {
                    "unitPrice": 0.8065195,
                    "retailPrice": 0.8065195,
                    "term": "3 Years"
                },
                {
                    "unitPrice": 1.5902195,
                    "retailPrice": 1.5902195,
                    "term": "1 Year"
                }
            ]
        },

API endpoint

https://prices.azure.com/api/retail/prices

API sample calls

Here are some examples:

Example calls filtered for only virtual machines:

https://prices.azure.com/api/retail/prices?$filter=serviceName eq 'Virtual Machines'

Example calls filtered for only reservations:

https://prices.azure.com/api/retail/prices?$filter=priceType eq 'Reservation'

Example calls filtered for reserved instance virtual machines:

https://prices.azure.com/api/retail/prices?$filter=serviceName eq 'Virtual Machines' and priceType eq 'Reservation'

Example calls filtered for compute resources:

https://prices.azure.com/api/retail/prices?$filter=serviceFamily eq 'Compute'

Example calls filtered for compute with currency in euro:

https://prices.azure.com/api/retail/prices?currencyCode='EUR'&$filter=serviceFamily eq 'Compute'

API response examples

Here's a sample API response, without reservation prices.

{
            "currencyCode": "USD",
            "tierMinimumUnits": 0.0,
            "retailPrice": 0.176346,
            "unitPrice": 0.176346,
            "armRegionName": "westeurope",
            "location": "EU West",
            "effectiveStartDate": "2020-08-01T00:00:00Z",
            "meterId": "000a794b-bdb0-58be-a0cd-0c3a0f222923",
            "meterName": "F16s Spot",
            "productId": "DZH318Z0BQPS",
            "skuId": "DZH318Z0BQPS/00TG",
            "productName": "Virtual Machines FS Series Windows",
            "skuName": "F16s Spot",
            "serviceName": "Virtual Machines",
            "serviceId": "DZH313Z7MMC8",
            "serviceFamily": "Compute",
            "unitOfMeasure": "1 Hour",
            "type": "DevTestConsumption",
            "isPrimaryMeterRegion": true,
            "armSkuName": "Standard_F16s"
        }

Here's a sample API response with reservation prices and term in the response.

{
            "currencyCode": "USD",
            "tierMinimumUnits": 0.0,
            "reservationTerm": "1 Year",
            "retailPrice": 25007.0,
            "unitPrice": 25007.0,
            "armRegionName": "southcentralus",
            "location": "US South Central",
            "effectiveStartDate": "2020-08-01T00:00:00Z",
            "meterId": "0016083a-928f-56fd-8eeb-39287dcf676d",
            "meterName": "E64 v4",
            "productId": "DZH318Z0D1L7",
            "skuId": "DZH318Z0D1L7/018J",
            "productName": "Virtual Machines Ev4 Series",
            "skuName": "E64 v4",
            "serviceName": "Virtual Machines",
            "serviceId": "DZH313Z7MMC8",
            "serviceFamily": "Compute",
            "unitOfMeasure": "1 Hour",
            "type": "Reservation",
            "isPrimaryMeterRegion": true,
            "armSkuName": "Standard_E64_v4"
        }

Here's a sample response with a non-USD currency.

{
  "currencyCode": "EUR",
  "tierMinimumUnits": 0,
  "retailPrice": 0.6176,
  "unitPrice": 0.6176,
  "armRegionName": "westeurope",
  "location": "EU West",
  "effectiveStartDate": "2021-04-01T00:00:00Z",
  "meterId": "000a794b-bdb0-58be-a0cd-0c3a0f222923",
  "meterName": "F16s Spot",
  "productId": "DZH318Z0BQPS",
  "skuId": "DZH318Z0BQPS/00TG",
  "productName": "Virtual Machines FS Series Windows",
  "skuName": "F16s Spot",
  "serviceName": "Virtual Machines",
  "serviceId": "DZH313Z7MMC8",
  "serviceFamily": "Compute",
  "unitOfMeasure": "1 Hour",
  "type": "Consumption",
  "isPrimaryMeterRegion": true,
  "armSkuName": "Standard_F16s"
}

API response pagination

The API response provides pagination. For each API request, a maximum of 1,000 records are returned. At the end of the API response, it has the link to next page. For example:

"NextPageLink": https://prices.azure.com:443/api/retail/prices?$filter=serviceName%20eq%20%27Virtual%20Machines%27&$skip=1000

API property details

Here's all the property details that are a part of the API response.

Field Example Values Definition
currencyCode USD The currency in which rates are defined and returns prices in USD unless specified.
tierMinimumUnits 0 Minimum units of consumption to avail the price
reservationTerm 1 year Reservation term – one year or three years
retailPrice 0.176346 Prices without discount
unitPrice 0.176346
armRegionName westeurope Azure Resource Manager region where the service is available. This version only supports prices on Commercial Cloud.
Location EU West Azure data center where the resource is deployed
effectiveStartDate 2020-08-01T00:00:00Z Optional field. Shows the date when the retail prices are effective.
meterId 000a794b-bdb0-58be-a0cd-0c3a0f222923 Unique identifier of the resource
meterName F16s Spot Name of the meter
productid DZH318Z0BQPS UniqueID of the product
skuId DZH318Z0BQPS/00TG UniqueID for the SKU
productName Virtual Machines FS Series Windows Product name
skuName F16s Spot SKU name
serviceName Virtual Machines Name of the service
serviceId DZH313Z7MMC8 UniqueID of the service
serviceFamily Compute Service family of the SKU
unitOfMeasure 1 Hour How usage is measured for the service
Type DevTestConsumption Meter consumption type. Other types are Reservation and Consumption.
isPrimaryMeterRegion True Indicates whether the meter region is set as a primary meter or not. Primary meters are used for charges and billing.
armSkuName Standard_F16s SKU name registered in Azure
term 3 Years Term length for an Azure savings plan, associated with savingsPlan information.

API filters

Filters are supported for the following fields:

  • armRegionName
  • Location
  • meterId
  • meterName
  • productid
  • skuId
  • productName
  • skuName
  • serviceName
  • serviceId
  • serviceFamily
  • priceType
  • armSkuName

You append the filters to the API endpoint, as shown in the API sample calls.

Supported currencies

You append the currency code to the API endpoint, as shown in the API sample call.

Currency code Detail
USD US dollar
AUD​ Australian dollar​
BRL​ Brazilian real​
CAD​ Canadian dollar​
CHF​ Swiss franc​
CNY​ Chinese yuan​
DKK​ Danish krone​
EUR​ Euro​
GBP​ British pound​
INR​ Indian rupee​
JPY​ Japanese yen​
KRW​ Korean won​
NOK​ Norwegian krone​
NZD​ New Zealand dollar​
RUB​ Russian ruble​
SEK​ Swedish krona​
TWD​ Taiwan dollar​

Programmatic Example

The following simple python application employs the API to query the retail spot pricing of a virtual machine of the standard NP20 SKU in the South Central US region. The application filters the output of the query and presents the desired information in a table format.

#!/usr/bin/env python3
import requests
import json
from tabulate import tabulate 


def build_pricing_table(json_data, table_data):
    for item in json_data['Items']:
        meter = item['meterName']
        table_data.append([item['armSkuName'], item['retailPrice'], item['unitOfMeasure'], item['armRegionName'], meter, item['productName']])
        
def main():
    table_data = []
    table_data.append(['SKU', 'Retail Price', 'Unit of Measure', 'Region', 'Meter', 'Product Name'])
    
    api_url = "https://prices.azure.com/api/retail/prices?api-version=2021-10-01-preview"
    query = "armRegionName eq 'southcentralus' and armSkuName eq 'Standard_NP20s' and priceType eq 'Consumption' and contains(meterName, 'Spot')"
    response = requests.get(api_url, params={'$filter': query})
    json_data = json.loads(response.text)
    
    build_pricing_table(json_data, table_data)
    nextPage = json_data['NextPageLink']
    
    while(nextPage):
        response = requests.get(nextPage)
        json_data = json.loads(response.text)
        nextPage = json_data['NextPageLink']
        build_pricing_table(json_data, table_data)

    print(tabulate(table_data, headers='firstrow', tablefmt='psql'))
    
if __name__ == "__main__":
    main()

Running this code produces the following output:

+----------------+----------------+-------------------+----------------+------------+------------------------------------+
| SKU            |   Retail Price | Unit of Measure   | Region         | Meter      | Product Name                       |
|----------------+----------------+-------------------+----------------+------------+------------------------------------|
| Standard_NP20s |       0.828503 | 1 Hour            | southcentralus | NP20s Spot | Virtual Machines NP Series Windows |
| Standard_NP20s |       0.448207 | 1 Hour            | southcentralus | NP20s Spot | Virtual Machines NP Series         |
+----------------+----------------+-------------------+----------------+------------+------------------------------------+

Next steps