Att Righ
Att Righ

Reputation: 1779

Azure query consumption from the command line

I want to see azure resource consumption from the command line.

I found this subcommand: https://learn.microsoft.com/en-us/cli/azure/consumption/usage?view=azure-cli-latest, but I'm getting errors:

az consumption usage --start-date 2021-10-01 --end-date 2021-11-02
'2021-10-01' is misspelled or not recognized by the system.

TRY THIS:
https://aka.ms/cli_ref
Read more about the command in reference docs

I don't understand this because the documentation says "Start date (YYYY-MM-DD in UTC)."

Upvotes: 0

Views: 403

Answers (2)

rickvdbosch
rickvdbosch

Reputation: 15571

You're missing the list command after the 'consumption usage' statement.

The following statement works on Azure CLI version 2.30.0:

az consumption usage list --start-date 2021-10-01 --end-date 2021-11-01

List the details of Azure resource consumption, either as an invoice or within a billing period.

az consumption usage list

Upvotes: 1

smholvoet
smholvoet

Reputation: 336

Did you try passing the dates in between quotation marks?

az consumption usage --start-date "2021-10-01" --end-date "2021-11-02"

Upvotes: 1

Related Questions