Azure price sheet api not returning the savings plan price details

Nikhil K M 0 Reputation points
2023-09-27T23:26:50.0566667+00:00

Hi everyone,

I am using the below api to get the custom discounted prices:-

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/default?api-version=2023-05-01

I need to get the discounted unitPrice as well as the discounted savingsPlan prices for 1 year and 3 years which is applicable to my subscription. I am able to get the unit price, but the json response is always showing savingsPlan as null as shown below, even if I use "$expand=savingsPlan" while calling api.

{
	"billingPeriodId": "xxxxxxxxxxx",
	"meterId": "xxxxxxxxxxx",
	"unitOfMeasure": "1 Hour",
	"includedQuantity": 0,
	"partNumber": "xxxxxxxxxxx",
	"unitPrice": 30.05,
	"currencyCode": "USD",
	"offerId": "MS-AZR-0017P",
	"meterDetails": null,
	"savingsPlan": null
}

In the documentation provided at Price Sheet - Get it shows the below sample response which contains savingsPlan details, but am not able to get that in the json response.

"savingsPlan": {
          "term": "P3Y",
          "effectivePrice": 0.002,
          "marketPrice": 0.00328
        }

Any way to get the savingsPlan details as in the above sample api response for 1 year and 3 years?

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

1 answer

Sort by: Most helpful
  1. Ryan Hill 28,106 Reputation points Microsoft Employee
    2023-09-30T20:46:01.7233333+00:00

    Hi @Nikhil K M

    If the price sheet API is returning null for the savingsPlan, it could because there are no savings plans associated with the subscription. Confirm this in the Azure portal under Cost Management + Billing > Cost Management, select the subscription, and select Savings Plans from the left-hand menu.

    If there are savings plans associated with the subscription, then there could be an issue with the API. In that case, please comment down below so I can inform the product team. Also, you can try using the cost details API, which is further explained under Get Azure consumption and savings plan cost data using API - Microsoft Cost Management | Microsoft Learn to generate a pricing report.


    EDIT 16 Oct 2023 I've heard back from the product team. The aforementioned API is a sync API that doesn't support showing service plan prices. Instead, you'll have to use the download version, Price Sheet - Download By Billing Account Period - REST API (Azure Consumption) | Microsoft Learn, to get service plan prices.


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.