none
Microsoft.Billing/billingPeriods API returns wrong billing period id/name RRS feed

  • Question

  • Hi!

    I have a question. When I call the billing periods API (both "2017-04-24-preview" and "2018-03-01-preview") I get a response like this where I feel the name ought to be "201906-1" instead of "201907-1":

    {
      "value": [
        {
          "id": "/subscriptions/000000000000/providers/Microsoft.Billing/billingPeriods/201907-1",
          "type": "Microsoft.Billing/billingPeriods",
          "name": "201907-1",
          "properties": {
            "billingPeriodStartDate": "2019-05-19",
            "billingPeriodEndDate": "2019-06-18"
          }
        },

    The strange thing is that the billing period ID shown in the portal is actually "201906" for these dates, not "201907" as is shown in the result. This response also doesn't seem to match the sample provided in the API reference.

    When I call the Microsoft.Consumption/usageDetails "2019-01-01" API I do get the correct billing period ID like this:

    {
      "value": [
        {
          "id": "/subscriptions/00000/providers/Microsoft.Billing/billingPeriods/201906/providers/Microsoft.Consumption/usageDetails/000000",
          "name": "00000000",
          "type": "Microsoft.Consumption/usageDetails",
          "tags": null,
          "properties": {
            "billingPeriodId": "/subscriptions/000000/providers/Microsoft.Billing/billingPeriods/201906",
            "usageStart": "2019-05-31T00:00:00.0000000Z",
            "usageEnd": "2019-05-31T23:59:59.0000000Z",

    So my question would be is this a bug, feature or am I even trying to enumerate billing periods the right way? Anyone else experiencing this?

    p.s. I don't have access to enterprise consumption API's.


    Monday, June 10, 2019 4:55 PM

All replies

  • Apologies for the delay, we are reviewing your issue and will get back to you shortly.
    Thursday, June 27, 2019 4:42 AM
    Moderator
  • @Martin Dahlborg We are aware of this issue and working on a fix. Stay tuned for the updates.

    Thursday, June 27, 2019 6:17 AM
    Moderator
  • @Martin Dahlborg Thanks for your patience. The current behavior projects the invoice period instead of the billing period, which is resulting in the discrepancy across these APIs. For the time being, you can work around the issue by parsing the billing period date from Microsoft.Billing and subtracting a month to match it with the billing period retrieved from Microsoft.Consumption/usageDetails 

    To convert e.g. 201907-01 to 201906, you could do something like:

    var name = "201907-1";
    var fixedName = DateTime.ParseExact(
                    name.Split('-')[0],
                    "yyyyMM",
                    CultureInfo.InvariantCulture)
                    .AddMonths(-1)
                    .ToString("yyyyMM");
    

    HTH

    Friday, June 28, 2019 6:12 AM
    Moderator