Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.98k forks source link

az consumption budget command faulty #23825

Open catluker-wandisco opened 2 years ago

catluker-wandisco commented 2 years ago

Hi

I'm seeing this problem every time I try to run this command to get the details for my subscription -

az consumption budget list Command group 'consumption' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus (422) This operation is not supported in the version specified in the request. Please use version 2019-10-01-preview or later. (Request ID: 8968fd1b-5987-4fc8-842a-69962d47f19f)

The command appears to be calling an out of date API - '2018-01-31' . My CLI version is 2.40.0.

Is this command actually working? If not it would be good if it wasn't available until it is.

Thanks

Cat


Document Details

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

ghost commented 2 years ago

Thank you for your feedback. This has been routed to the support team for assistance.

yonzhan commented 2 years ago

route to CXP team

RakeshMohanMSFT commented 2 years ago

@catluker-wandisco Thank you for reaching out, we are looking into it.

RakeshMohanMSFT commented 2 years ago

@catluker-wandisco We are unable to reproduce this issue? can you share your environment details using az --version?

image

catluker-wandisco commented 2 years ago

Hi

I'm using a Mac and the details are Cats-MBP:~ cat$ az --version azure-cli 2.40.0

core 2.40.0 telemetry 1.0.8

Extensions: alias 0.5.2 front-door 1.0.16 azure-devops 0.20.0 storage-preview 0.8.0 livedata 0.16.0 providerhub 0.2.0 application-insights 0.1.14 costmanagement 0.2.1

Dependencies: msal 1.18.0b1 azure-mgmt-resource 21.1.0b1

Python location '/usr/local/Cellar/azure-cli/2.40.0/libexec/bin/python' Extensions directory '/Users/cat/.azure/cliextensions'

Python (Darwin) 3.10.6 (main, Aug 30 2022, 05:09:33) [Clang 12.0.0 (clang-1200.0.32.29)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Other az-cli commands are working as expected, it's just the commands I mentioned that are giving this specific error. These commands would be very useful for me (within the az-cli, not using Powershell) so I'd appreciate it if you could have another look.

Thanks

On Fri, 9 Sept 2022 at 05:52, RakeshMohan-MSFT @.***> wrote:

@catluker-wandisco https://github.com/catluker-wandisco We are unable to reproduce this issue? can you share your environment details using az --version?

[image: image] https://user-images.githubusercontent.com/49954584/189274325-4df2d5e1-393b-4e50-b4d0-aeb0601131c1.png

— Reply to this email directly, view it on GitHub https://github.com/Azure/azure-cli/issues/23825#issuecomment-1241497132, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ6G6SZAXZ4CPVD62X6HFJDV5K7BFANCNFSM6AAAAAAQH2YSOU . You are receiving this because you were mentioned.Message ID: @.***>

--

http://www.wandisco.com

THIS MESSAGE AND ANY ATTACHMENTS ARE CONFIDENTIAL, PROPRIETARY AND MAY BE PRIVILEGED

If this message was misdirected, WANdisco, Inc. and its subsidiaries, ("WANdisco") does not waive any confidentiality or privilege. If you are not the intended recipient, please notify us immediately and destroy the message without disclosing its contents to anyone. Any distribution, use or copying of this email or the information it contains by other than an intended recipient is unauthorized. The views and opinions expressed in this email message are the author's own and may not reflect the views and opinions of WANdisco, unless the author is authorized by WANdisco to express such views or opinions on its behalf. All email sent to or from this address is subject to electronic storage and review by WANdisco. Although WANdisco operates anti-virus programs, it does not accept responsibility for any damage whatsoever caused by viruses being passed.

RakeshMohanMSFT commented 2 years ago

@catluker-wandisco I am really unable to reproduce this issue, let me engage the product team to look into it.

zomilanovic commented 2 years ago

I have the same issue on an Intel iMac running macOS Version 12.6 (Monterey).

az --version has the following output:

azure-cli                         2.40.0

core                              2.40.0
telemetry                          1.0.8

Extensions:
ssh                                1.1.2
dataprotection                     0.6.0
serial-console                     0.1.2

Dependencies:
msal                            1.18.0b1
azure-mgmt-resource             21.1.0b1

Python location '/usr/local/Cellar/azure-cli/2.40.0/libexec/bin/python'
Extensions directory '/Users/milo/.azure/cliextensions'

Python (Darwin) 3.10.6 (main, Aug 30 2022, 05:12:36) [Clang 13.1.6 (clang-1316.0.21.2.5)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Running the az consumption budget list command fails with the following output:

Command group 'consumption' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
(422) This operation is not supported in the version specified in the request. Please use version 2018-12-01-preview or later. (Request ID: c04aeda6-ce67-49cf-a850-ca2687e99f6d)

When I run the command with the --debug flag, I found the following line(s) of the output hints the "culprit":

.
.
.
msrest.http_logger: Request URL: 'https://management.azure.com/subscriptions/<redacted-subscription-id>/providers/Microsoft.Consumption/budgets/vps-abo?api-version=2018-01-31'
.
.
.
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/<redacted-subscription-id>/providers/Microsoft.Consumption/budgets?api-version=2018-01-31 HTTP/1.1" 422 208
.
.
.

I think it would be handy if there were a way to specify which api-version is used by az with an according flag or something similar to avoid problems like this in the future.

Thanks in advance, and I hope the information provided helps resolve this issue!

catluker-wandisco commented 2 years ago

Yes, that's exactly what I see - --debug shows me the GET request that's sent is going to

urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions//providers/Microsoft.Consumption/budgets/?api-version=2018-01-31 HTTP/1.1" 422 208

and the resulting error is

msrest.exceptions: (422) This operation is not supported in the version specified in the request. Please use version 2019-10-01-preview or later. (Request ID: e2e72bb6-312f-47c2-823f-60f0b310db34)

cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception: cli.azure.cli.core.util: Traceback (most recent call last): File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, kwargs) File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 363, in handler show_exception_handler(ex) File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/arm.py", line 429, in show_exception_handler raise ex File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 361, in handler return op(command_args) File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/consumption/custom.py", line 103, in cli_consumption_show_budget return client.get(budget_name) File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/mgmt/consumption/operations/budgets_operations.py", line 212, in get raise models.ErrorResponseException(self._deserialize, response) azure.mgmt.consumption.models.error_response.ErrorResponseException: (422) This operation is not supported in the version specified in the request. Please use version 2019-10-01-preview or later. (Request ID: e2e72bb6-312f-47c2-823f-60f0b310db34)

zomilanovic commented 2 years ago

@RakeshMohanMSFT any news or updates from the product team so far? Did the additional information we gave you help?

danieldjewell commented 1 year ago

I can also confirm that I'm seeing this issue with the latest version of azure-cli installed ....

It may have something to do with the fact that the version of the azure.mgmt.consumption Python module that is installed is only v2.0.0 and yet it would appear that the current version is v11 (see https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/consumption/azure-mgmt-consumption/azure/mgmt/consumption/_version.py)

It would appear that v2.0 azure.mgmt.consumption module is older than May, 2019.....

Edit: See the package requirements here: https://github.com/Azure/azure-cli/blob/8e7d910a378d5405ecd1fa0760e78a3ddd4b6f04/src/azure-cli/requirements.py3.Linux.txt#L35

The fact that there are just so many individual modules in the azure-mgmt-* namespace -while indeed flexible- does appear to add a level of complexity to ensure that the correct/latest versions are used.

Edit2: For what it's worth, there appear to be breaking changes in the design of azure-mgmt-consumption as doing a pip install -U azure-mgmt-consumption (which will update the module to v10.0.0) will break the current version of azure-cli.

joelfernandes23 commented 1 year ago

Issue seems to be still active as of July 2023. az consumption usage list Command group 'consumption' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus (400) Subscription scope usage is not supported for current api version. Please use api version after 2019-10-01 (Request ID: b03618b4-6fc9-4cc0-b359-6149084125c4)

CarlosJoseChaconChavarria commented 1 year ago

Issue seems to be still active as of July 2023. az consumption usage list Command group 'consumption' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus (400) Subscription scope usage is not supported for current api version. Please use api version after 2019-10-01 (Request ID: b03618b4-6fc9-4cc0-b359-6149084125c4)

yes indeed

jarrettprosser commented 1 year ago

I'm getting the same error on Mac with az-cli 2.52.0.