Billing Period Name parameter not being accepted
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.
- ID: e05c0768-9cfc-3b78-4f39-70a8c1f0b6bd
- Version Independent ID: b5e5d8fa-e84c-408a-3f49-19d245563abd
- Content: az consumption usage
- Content Source: src/azure-cli/azure/cli/command_modules/consumption/_help.py
- Service: consumption
- GitHub Login: @rloutlaw
- Microsoft Alias: routlaw
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
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.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc
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
move to S167
move to S168
move to S169
move to S170