azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Billing Period Name parameter not being accepted

Open sayanghosh123 opened this issue 7 years ago • 8 comments

I have retrieved the names of billing periods using "az billing period list" and then have called "az consumption usage list --billing-period-name "retrievedname" --include-additional-properties --include-meter-details". The cli always returns back

Invalid Billing period retrivedname supplied for subscription ----. (Request ID: ----)

I have tried both single and double quotes around the period name....any pointers please?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

sayanghosh123 avatar Aug 13 '19 13:08 sayanghosh123

I also noticed that if I pass the id of the billing period in place of name such as "/subscriptions/------/providers/Microsoft.Billing/billingPeriods/retrievedname" the error message changes to

The resource type 'billingPeriods' could not be found in the namespace 'Microsoft.Billing' for api version '2018-01-31'. The supported api-versions are '2017-04-24-preview,2018-03-01-preview'.

This leads me to suspect if it's actually trying to use the ID but then somehow runs into another error? I am on the latest version of Azure CLI

sayanghosh123 avatar Aug 13 '19 13:08 sayanghosh123

Probably the same problem here.

$ az consumption usage list -a -m -p 0
Command group 'consumption' is in preview. It may be changed/removed in a future release.
Invalid Billing period 0 supplied for subscription 02bc3d8e-6f58-4fe5-bf25-c630464edd9f. Valid Billing periods from Billing RP are 201910-1, 201909-1, 201908-1, 201907-1, 201906-1, 201905-1, 201904-1, 201903-1, 201902-1, 201901-1, 201812-1, 201811-1, 201810-1 (Request ID: 97e2938d-f1ca-4030-9570-7c7ea6277100)
$ az consumption usage list -a -m -p 201910-1
Command group 'consumption' is in preview. It may be changed/removed in a future release.
Invalid Billing period 201910-1 supplied for subscription 02bc3d8e-6f58-4fe5-bf25-c630464edd9f. (Request ID: 194f42aa-e181-4882-9b33-a27a77c706d3)

The following "period" specifications return the same usage list for the most recent billing period. It's 2019-08-02 to 2019-09-01 for me.

$ az consumption usage list -a -m -p 201909-1
$ az consumption usage list -a -m -p 201909
$ az consumption usage list -a -m -p 20190912345
$ az consumption usage list -a -m -p 201909abcde
$ az --version
azure-cli                         2.0.70 *

command-modules-nspkg               2.0.3
core                              2.0.70 *
nspkg                              3.0.4
telemetry                          1.0.3

Python location '/Users/yaegashi/lib/azure-cli/bin/python'
Extensions directory '/Users/yaegashi/.azure/cliextensions'

Python (Darwin) 2.7.10 (default, Feb 22 2019, 21:55:15) 
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)]

Legal docs and information: aka.ms/AzureCliLegal


You have 2 updates available. Consider updating your CLI installation.

yaegashi avatar Aug 20 '19 20:08 yaegashi

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc

ghost avatar Dec 04 '19 07:12 ghost

Hi Sayan,

Sorry for the inconvenience. Billing Periods are being deprecated and won't be supported in the long term.

To get usage through Azure cli, you can directly pass in dates using -s and -e options https://docs.microsoft.com/en-us/cli/azure/consumption/usage?view=azure-cli-latest az consumption usage list -s -e

However the Consumption team recommends that you directly call the REST API https://docs.microsoft.com/en-us/rest/api/consumption/usagedetails/list

Thanks Muaz

muazmian avatar Feb 15 '20 00:02 muazmian

move to S167

yonzhan avatar Mar 07 '20 03:03 yonzhan

move to S168

yonzhan avatar Mar 28 '20 04:03 yonzhan

move to S169

yonzhan avatar Apr 18 '20 12:04 yonzhan

move to S170

yonzhan avatar May 16 '20 05:05 yonzhan