Azure / azure-cli

Azure Command-Line Interface
MIT License
4.02k stars 2.99k forks source link

bug in az consumption #29468

Open increff-megananthan-k opened 3 months ago

increff-megananthan-k commented 3 months ago

Describe the bug

using az consumption is giving errors.

Related command

az consumption usage list --start-date 2024-06-01 --end-date 2024-06-30

Errors

az consumption usage list --start-date 2024-06-01 --end-date 2024-06-30
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus The command failed with an unexpected error. Here is the traceback: 'usageStart' Traceback (most recent call last): File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 664, in execute raise ex File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 731, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 714, in _run_job result = list(result) ^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/aaz/_paging.py", line 87, in next return next(self._page_iterator) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/aaz/_paging.py", line 46, in next curr_page, self._next_link = self._extract_result() ^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/consumption/custom.py", line 85, in _output result = list([transform_usage_output(item) for item in result]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/consumption/custom.py", line 85, in result = list([transform_usage_output(item) for item in result]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/consumption/custom.py", line 95, in transform_usage_output usageStart = parser.parse(result['usageStart'])


KeyError: 'usageStart'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

### Issue script & Debug output

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
cli.azure.cli.core.azclierror: 'usageStart'
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 714, in _run_job
    result = list(result)
             ^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/aaz/_paging.py", line 87, in __next__
    return next(self._page_iterator)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/aaz/_paging.py", line 46, in __next__
    curr_page, self._next_link = self._extract_result()
                                 ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/consumption/custom.py", line 85, in _output
    result = list([transform_usage_output(item) for item in result])
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/consumption/custom.py", line 85, in <listcomp>
    result = list([transform_usage_output(item) for item in result])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/consumption/custom.py", line 95, in transform_usage_output
    usageStart = parser.parse(result['usageStart'])
                              ~~~~~~^^^^^^^^^^^^^^
KeyError: 'usageStart'
az_command_data_logger: 'usageStart'
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 714, in _run_job
    result = list(result)
             ^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/aaz/_paging.py", line 87, in __next__
    return next(self._page_iterator)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/aaz/_paging.py", line 46, in __next__
    curr_page, self._next_link = self._extract_result()
                                 ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/consumption/custom.py", line 85, in _output
    result = list([transform_usage_output(item) for item in result])
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/consumption/custom.py", line 85, in <listcomp>
    result = list([transform_usage_output(item) for item in result])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/consumption/custom.py", line 95, in transform_usage_output
    usageStart = parser.parse(result['usageStart'])
                              ~~~~~~^^^^^^^^^^^^^^
KeyError: 'usageStart'

### Expected behavior

when --debug i am getting the correct response but getting a error after that in the same command.

### Environment Summary

azure-cli                         2.62.0

core                              2.62.0
telemetry                          1.1.0

Extensions:
arcdata                           1.5.13
costmanagement                     0.3.0

Dependencies:
msal                              1.28.1
azure-mgmt-resource               23.1.1

Python location '/opt/homebrew/Cellar/azure-cli/2.62.0/libexec/bin/python'

Python (Darwin) 3.11.9 (main, Apr  2 2024, 08:25:04) [Clang 15.0.0 (clang-1500.3.9.4)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

### Additional context

_No response_
yonzhan commented 3 months ago

Thank you for opening this issue, we will look into it.

microsoft-github-policy-service[bot] commented 3 months ago

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

increff-megananthan-k commented 3 months ago

any update??

venstar commented 1 month ago

I have the similar error with

az consumption usage list

I am interested in a solution/fix

thyagvmware commented 1 month ago

I am getting the same error . Any update on this please