0

Using Microsoft Azure's billing and usage API, I see that we can get the usage quantity of a resource for a project and the rate for the resource consumption from the rate card API. However, the rate card API, in some cases, has a list of key-value pairs.

For ex, consider the following MeterRates:

"MeterRates": {
                "0": 0.0832,
                "1024": 0.0819,
                "51200": 0.0806,
                "512000": 0.0794,
                "1024000": 0.0775,
                "5120000": 0.0775
            },

Here, if the usage quantity is, say, 102400; does it mean the cost of using the resource will be 102400 * 0.0784 or (102400 - 1023) * 0.0832 + (102400 - 1023 - 51200) * 0.0819?

N.B.: I have an issue on the github repository for the billing and usage API regarding the same.

jobin
  • 2,600
  • 7
  • 32
  • 59

2 Answers2

1

Here, if the usage quantity is, say, 102400; does it mean the cost of using the resource will be 102400 * 0.0784 or (102400 - 1023) * 0.0832 + (102400 - 1023 - 51200) * 0.0819?

It will actually be more like: 1023 * 0.0832 + 50176 * 0.0819 + 460800 * 0.0794 + 512000 * 0.0775

Essentially these are pricing tiers so the way you read them is from 0 to 1023, it would be 0.0832 / unit. From 1024 - 51200, it would be 0.0819 units and so on.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • Thanks Gaurav for answering, but is there some way I can easily validate this except of course, getting a metric which has multiple meter rates and then calculating the cost? – jobin Sep 12 '15 at 12:34
  • ... and not to mention consuming this much quantity and the comparing the calculation with what's shown on the bill :). Other way would be to get this confirmed by someone from Azure Billing API team. – Gaurav Mantri Sep 12 '15 at 12:44
  • Also to add to Gaurav's comment, you should be cautious while making this calculation of the usage for that meter ID which has already happened for that billing period. E.g. if the meter ID is for a specific storage type, then you should also check what is the consumption that has already occurred for that when calculating the rate for a new usage record. – Aman Sharma Apr 19 '16 at 23:08
1

+1 to Gaurav's response!

RateCard follows tiered pricing, which means that if there are multiple tiers for rating a particular resource, each subset of usage in each tier is rated differently.

Let’s take another example for consumed quantity = 250

Let’s assume the rates:

0: 1 200: 0.9 500: 0.8

This means that usage for units 0 – 199 should be rated at 1 per unit, 200 – 499 at 0.9 per unit and 500+ at 0.8 per unit.

Consumed quantity of 250 would be billed at: 51*0.9 + 199 * 1 = 244.9

  • Clarifies everything! Thanks! – jobin Sep 24 '15 at 23:48
  • is this per billing cycle? I mean let's say my billing cycle is from the first of the month to the first of next month and I the usage from day 3 do I need to aggregate the usage for day 1, 2 and 3 and then apply the tier pricing or can this be done on a per day basis? – Filip Stas Sep 25 '15 at 18:32