Using the azure retail price API how can I get a price for a disk

Kieran Pierce 0 Reputation points
2023-04-13T08:54:04.1933333+00:00

I have the following JSON SKU: *github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute.DiskSKU {Name: *"StandardSSD_LRS", Tier: *"Standard"}, this is returned from the following API GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks?api-version=2021-12-01 what i want to do is get the price for this, i have tried the following https://prices.azure.com/api/retail/prices?$filter=serviceName eq 'Azure Compute' and armSkuName eq 'StandardSSD_LRS' and location eq 'westeurope' but this result is empty what am i missing ?

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

1 answer

Sort by: Most helpful
  1. SadiqhAhmed-MSFT 41,716 Reputation points Microsoft Employee
    2023-04-13T09:44:47.26+00:00

    Hello @Kieran Pierce Thank you for reaching out to us on Microsoft Q&A platform. Happy to help!
    To get the price for a disk using the Azure Retail price API, you can use the following steps:

    1. Determine the SKU of the disk you want to price. You can find this information in the Azure portal or by using the Azure CLI or PowerShell.
    2. Use the Azure Retail price API to retrieve the price for the SKU. The API endpoint is https://prices.azure.com/api/retail/prices. You can use the following query parameters to filter the results:
    • $filter: Use this parameter to filter the results based on the SKU. The syntax for the filter is sku eq '{sku}'.
    • $top: Use this parameter to limit the number of results returned. In this case, you only need one result, so you can set $top=1. Here's an example of how to use the Azure Retail price API to retrieve the price for a disk SKU:
    GET https://prices.azure.com/api/retail/prices?$filter=sku eq 'sku-of-disk'&$top=1
    

    Make sure to replace sku-of-disk with the actual SKU of the disk you want to price. The API will return a JSON object that includes the price information for the SKU, including the currency, unit of measure, and price per unit. Note that the Azure Retail price API provides retail prices, which are list prices and may not reflect any discounts or special pricing that you may be eligible for. If you have an Azure subscription, you can also use the Azure Pricing calculator to estimate the cost of your resources based on your specific configuration and pricing plan.

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