azure-cli-extensions
azure-cli-extensions copied to clipboard
az quota list scope input not processed properly
Describe the bug
When attempting to use az quota list --scope {scope}, no matter how I put in the argument for scope, it will either return a python error (if put in as a string or without anything surrounding the argument), or simply hang and never complete (if surrounded with {}) --verbose option also does not give any output at any point during hanging period to indicate what is happening.
https://learn.microsoft.com/en-us/cli/azure/quota?view=azure-cli-latest#az-quota-list indicates that input for --scope should be a string, but this causes an error.
Command Name
az quota list Extension Name: quota. Version: 0.1.0.
Errors:
The command failed with an unexpected error. Here is the traceback:
("Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'", AttributeError("'str' object has no attribute 'get'"))
Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/msrest/serialization.py", line 1436, in _deserialize
found_value = key_extractor(attr, attr_desc, data)
File "/opt/az/lib/python3.10/site-packages/msrest/serialization.py", line 1180, in rest_key_extractor
return working_data.get(key)
AttributeError: 'str' object has no attribute 'get'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
raise ex
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 710, in _run_job
result = list(result)
File "/opt/az/lib/python3.10/site-packages/azure/core/paging.py", line 129, in __next__
return next(self._page_iterator)
File "/opt/az/lib/python3.10/site-packages/azure/core/paging.py", line 76, in __next__
self._response = self._get_next(self.continuation_token)
File "/home/jlunder/.azure/cliextensions/quota/azext_quota/vendored_sdks/quota/operations/_quota_operations.py", line 464, in get_next
error = self._deserialize(models.exceptionresponse, response)
File "/opt/az/lib/python3.10/site-packages/msrest/serialization.py", line 1376, in __call__
return self._deserialize(target_obj, data)
File "/opt/az/lib/python3.10/site-packages/msrest/serialization.py", line 1454, in _deserialize
raise_with_traceback(DeserializationError, msg, err)
File "/opt/az/lib/python3.10/site-packages/msrest/exceptions.py", line 51, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "/opt/az/lib/python3.10/site-packages/msrest/serialization.py", line 1436, in _deserialize
found_value = key_extractor(attr, attr_desc, data)
File "/opt/az/lib/python3.10/site-packages/msrest/serialization.py", line 1180, in rest_key_extractor
return working_data.get(key)
azure.core.exceptions.DeserializationError: ("Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'", AttributeError("'str' object has no attribute 'get'"))
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
-
az login
-
az quota list --scope "subscriptions/<subscription_id>/providers/Microsoft.Compute/locations/<location>" --verbose
Errors:
Program hangs indefinitely
To Reproduce:
-
az login
-
az quota list --scope {subscriptions/<subscription_id>/providers/Microsoft.Compute/locations/<location>} --verbose
Expected Behavior
Return a list of quota information for the region and subscription id
Actual Behavior
When --scope option argument is put in as {argument}, the program hangs without explanation and never completes. When put in as "argument", or just argument, gets a python error dealing with attempting to call a string function that doesnt exist, when deserializing.
Environment Summary
Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.31, Ubuntu 20.04.4 LTS
Python 3.10.5
Installer: DEB
azure-cli 2.40.0
Extensions:
quota 0.1.0
support 1.0.3
Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1
Additional Context
Thank you for your feedback. This has been routed to the support team for assistance.
quota
@jlunder00 Apologies for the late reply. Thanks for reaching out to us and reporting this issue. We are looking into this issue and we will provide an update.
@jlunder00 Pasting the reply from the other thread: https://github.com/Azure/azure-sdk-for-go/issues/18567
The QuotaRP will go to public preview on tentative date 10/20/22. We are working with all the teams to get sign off for public preview sign off. I will will update the exact date, when we get sign off.
May I know what was the --scope you had used ? I can the command for Quotas_listQuotaLimitsForCompute and I didnt get the above error. Could you please invoke the rest api deirectly from the azcli using the below command depending on the scope you are using and see if you encounter the same issue ?
Sample CLI Rest command:
az rest --url https://management.azure.com/subscriptions/XXXXXXX/providers/Microsoft.Compute/ locations/eastus/providers/Microsoft.Quota/quotas?api-version=2021-03-15-preview
@navba-MSFT I tried your suggestion below. Note, I replaced XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX with my actual subscription id when running the specified commands.
az rest --url https://management.azure.com/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/quotas?api-version=2021-03-15-preview
Results in:
Not Found("{\"error\":{\"code\":\"InvalidResourceType\",\"message\":\"The resource type 'locations' could not be found in the namespace 'Microsoft.Compute' for api version '2021-03-15-preview'. The supported api-versions are '2015-05-01-preview,2015-06-15,2016-03-30,2016-04-30-preview,2016-08-30,2017-03-30,2017-12-01,2018-04-01,2018-06-01,2018-10-01,2019-03-01,2019-07-01,2019-12-01,2020-06-01,2020-12-01,2021-03-01,2021-04-01,2021-07-01,2021-11-01,2022-03-01,2022-08-01'.\"}}")
This is the result for any version number not included in the list shown, so I tried changing the api version:
Changing the api version to 2022-08-01 (or any version in the list from the previous error message): az rest --url https://management.azure.com/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/quotas?api-version=2022-08-01
Results in:
Bad Request("{\r\n \"error\": {\r\n \"innererror\": {\r\n \"internalErrorCode\": \"RequestUrlInvalid\"\r\n },\r\n \"code\": \"BadRequest\",\r\n \"message\": \"The request URL is not valid.\"\r\n }\r\n}")
The az quota command I was using is:
az quota list --scope "subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/providers/Microsoft.Compute/locations/eastus" --verbose
But this results in:
Command group 'quota' is experimental and under development. Reference and support levels: https://aka.ms/CLI_refstatus
The command failed with an unexpected error. Here is the traceback:
("Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'", AttributeError("'str' object has no attribute 'get'"))
Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/msrest/serialization.py", line 1436, in _deserialize
found_value = key_extractor(attr, attr_desc, data)
File "/opt/az/lib/python3.10/site-packages/msrest/serialization.py", line 1180, in rest_key_extractor
return working_data.get(key)
AttributeError: 'str' object has no attribute 'get'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
raise ex
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 710, in _run_job
result = list(result)
File "/opt/az/lib/python3.10/site-packages/azure/core/paging.py", line 129, in __next__
return next(self._page_iterator)
File "/opt/az/lib/python3.10/site-packages/azure/core/paging.py", line 76, in __next__
self._response = self._get_next(self.continuation_token)
File "/home/jlunder/.azure/cliextensions/quota/azext_quota/vendored_sdks/quota/operations/_quota_operations.py", line 464, in get_next
error = self._deserialize(models.exceptionresponse, response)
File "/opt/az/lib/python3.10/site-packages/msrest/serialization.py", line 1376, in __call__
return self._deserialize(target_obj, data)
File "/opt/az/lib/python3.10/site-packages/msrest/serialization.py", line 1454, in _deserialize
raise_with_traceback(DeserializationError, msg, err)
File "/opt/az/lib/python3.10/site-packages/msrest/exceptions.py", line 51, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "/opt/az/lib/python3.10/site-packages/msrest/serialization.py", line 1436, in _deserialize
found_value = key_extractor(attr, attr_desc, data)
File "/opt/az/lib/python3.10/site-packages/msrest/serialization.py", line 1180, in rest_key_extractor
return working_data.get(key)
azure.core.exceptions.DeserializationError: ("Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'", AttributeError("'str' object has no attribute 'get'"))
To open an issue, please run: 'az feedback'
Command ran in 35.619 seconds (init: 1.901, invoke: 33.719)
And when I run az quota with the scope parameter encapsulated in {} rather than "" (The docs say to use quotes, but using {} gives a different, and maybe better? response): az quota list --scope {subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/providers/Microsoft.Compute/locations/eastus} --verbose
I get:
Command group 'quota' is experimental and under development. Reference and support levels: https://aka.ms/CLI_refstatus
And then the program hangs and does not complete. I tried again and it has been running for several minutes with no indication of an error nor of progress of any kind. I eventually killed it after it ran for nearly 10 minutes.
@jlunder00 I too get the below error and it is a known issue. We are in touch with the Product owners to fix this.
Not Found("{\"error\":{\"code\":\"InvalidResourceType\",\"message\":\"The resource type 'locations' could not be found in the namespace 'Microsoft.Compute' for api version '2021-03-15-preview'. The supported api-versions are '2015-05-01-preview,2015-06-15,2016-03-30,2016-04-30-preview,2016-08-30,2017-03-30,2017-12-01,2018-04-01,2018-06-01,2018-10-01,2019-03-01,2019-07-01,2019-12-01,2020-06-01,2020-12-01,2021-03-01,2021-04-01,2021-07-01,2021-11-01,2022-03-01,2022-08-01'.\"}}")
As mentioned earlier, We have received the below response from the Product owners:
The QuotaRP will go to public preview on tentative date 10/20/22. We are working with all the teams to get sign off for public preview sign off. I will will update the exact date, when we get sign off.
So I will keep you posted on the progress and update this thread.
@jlunder00 I am able to invoke the quota usage rest api and it is working fine for me now. Could you please run the below command and test again ?
az rest --url https://management.azure.com/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/quotas?api-version=2022-08-01
Awaiting your reply.
@jlunder00 I wanted to do quick follow-up to check if you had a chance to look at my above comment. Please let us know if you had any updates on this. Awaiting your reply.
@navba-MSFT I'll give this a try tomorrow and get back to you. Thanks!
@jlunder00 I wanted to do quick follow-up to check if you had a chance to look at my above comment. Please let us know if you had any updates on this. Awaiting your reply.
The Quota APIs are now in public preview. You can access the APIs now. Previously, it was behind AFEC (Feature flag) that's why you got the error.
The Microsoft.Quota supports Azure virtual machines (cores/vCPU), Azure Machine Learning, Azure Networking, Azure HPC Cache and Azure Purview services.
@jlunder00 This issue should be fixed now. The action is currently pending on you to try the above command again. We will now proceed with closure of this GitHub issue. If you need any further assistance on this issue in future, please feel free to reopen this thread. We would be happy to help.