Azure / azure-cli

Azure Command-Line Interface
MIT License
3.97k stars 2.95k forks source link

Bug report #20522

Open stefanovic-io opened 2 years ago

stefanovic-io commented 2 years ago

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az monitor activity-log alert create

Errors:

The command failed with an unexpected error. Here is the traceback:
Cannot deserialize content-type: text/html
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 712, in _run_job
    return cmd_copy.exception_handler(ex)
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/command_modules/monitor/_exception_handler.py", line 23, in exception_handler
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/command_modules/monitor/operations/activity_log_alerts.py", line 65, in create
    if _get_alert_settings(client, resource_group_name, activity_log_alert_name, throw_if_missing=False):
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/command_modules/monitor/operations/activity_log_alerts.py", line 218, in _get_alert_settings
    return client.get(resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name)
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py", line 169, in get
    error = self._deserialize(_models.ErrorResponse, response)
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/msrest/serialization.py", line 1367, in __call__
    data = self._unpack_content(response_data, content_type)
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/msrest/serialization.py", line 1539, in _unpack_content
    return RawDeserializer.deserialize_from_http_generics(
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/msrest/pipeline/universal.py", line 226, in deserialize_from_http_generics
    return cls.deserialize_from_text(body_bytes, content_type)
  File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/msrest/pipeline/universal.py", line 203, in deserialize_from_text
    raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))
msrest.exceptions.DeserializationError: Cannot deserialize content-type: text/html

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

Expected Behavior

Environment Summary

macOS-12.0.1-arm64-arm-64bit, Darwin 21.1.0
Python 3.9.7
Installer: HOMEBREW

azure-cli 2.30.0

Extensions:
account 0.2.1
scheduled-query 0.4.0

Additional Context

yonzhan commented 2 years ago

monitor

kairu-ms commented 2 years ago

Hi @the-aleksandar, This API can work if the command request is success. However, when service response error, the error above will be raised. You can add --debug to see the detail error response and correct your command. Thanks.

ghost commented 2 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @SameergMS, @dadunl.

Issue Details
### **This is autogenerated. Please review and update as needed.** ## Describe the bug **Command Name** `az monitor activity-log alert create` **Errors:** ``` The command failed with an unexpected error. Here is the traceback: Cannot deserialize content-type: text/html Traceback (most recent call last): File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/knack/cli.py", line 231, in invoke cmd_result = self.invocation.execute(args) File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute raise ex File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 712, in _run_job return cmd_copy.exception_handler(ex) File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/command_modules/monitor/_exception_handler.py", line 23, in exception_handler raise ex File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job result = cmd_copy(params) File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__ return self.handler(*args, **kwargs) File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/command_modules/monitor/operations/activity_log_alerts.py", line 65, in create if _get_alert_settings(client, resource_group_name, activity_log_alert_name, throw_if_missing=False): File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/command_modules/monitor/operations/activity_log_alerts.py", line 218, in _get_alert_settings return client.get(resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name) File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py", line 169, in get error = self._deserialize(_models.ErrorResponse, response) File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/msrest/serialization.py", line 1367, in __call__ data = self._unpack_content(response_data, content_type) File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/msrest/serialization.py", line 1539, in _unpack_content return RawDeserializer.deserialize_from_http_generics( File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/msrest/pipeline/universal.py", line 226, in deserialize_from_http_generics return cls.deserialize_from_text(body_bytes, content_type) File "/opt/homebrew/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/msrest/pipeline/universal.py", line 203, in deserialize_from_text raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) msrest.exceptions.DeserializationError: Cannot deserialize content-type: text/html ``` ## To Reproduce: Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information. - _Put any pre-requisite steps here..._ - `az monitor activity-log alert create --name {} --resource-group {} --action-group {} --condition {} {} {} --description {}` ## Expected Behavior ## Environment Summary ``` macOS-12.0.1-arm64-arm-64bit, Darwin 21.1.0 Python 3.9.7 Installer: HOMEBREW azure-cli 2.30.0 Extensions: account 0.2.1 scheduled-query 0.4.0 ``` ## Additional Context
Author: the-aleksandar
Assignees: kairu-ms
Labels: `Service Attention`, `Monitor`, `customer-reported`, `feature-request`
Milestone: Backlog
fcl-9 commented 1 year ago

Hi, did anyone find the reason for the issue, I am currently facing the same but with other command, in my case "az pipelines list" which comes from azuredevops extension also getting the same for other commands az repo etc...

Describe the bug

Command Name az pipelines list Extension Name: azure-devops. Version: 0.25.0.

Errors:

The command failed with an unexpected error. Here is the traceback:
Cannot deserialize content-type: text/html
Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 718, in _run_job
  File "C:\Users\fcl\.azure\cliextensions\azure-devops\azext_devops\dev\common\exception_handler.py", line 31, in azure_devops_exception_handler
    reraise(*sys.exc_info())
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\six.py", line 719, in reraise
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "C:\Users\fcl\.azure\cliextensions\azure-devops\azext_devops\dev\pipelines\pipeline.py", line 47, in pipeline_list
    client = get_build_client(organization)
  File "C:\Users\fcl\.azure\cliextensions\azure-devops\azext_devops\dev\common\services.py", line 185, in get_build_client
    return connection.get_client(VSTS_MODULE + 'v5_0.build.build_client.BuildClient')
  File "C:\Users\fcl\.azure\cliextensions\azure-devops\azext_devops\devops_sdk\connection.py", line 37, in get_client
    self._client_cache[client_type] = self._get_client_instance(client_class)
  File "C:\Users\fcl\.azure\cliextensions\azure-devops\azext_devops\devops_sdk\connection.py", line 50, in _get_client_instance
    url = self._get_url_for_client_instance(client_class)
  File "C:\Users\fcl\.azure\cliextensions\azure-devops\azext_devops\devops_sdk\connection.py", line 62, in _get_url_for_client_instance
    resource_areas = self._get_resource_areas()
  File "C:\Users\fcl\.azure\cliextensions\azure-devops\azext_devops\devops_sdk\connection.py", line 111, in _get_resource_areas
    self._resource_areas = location_client.get_resource_areas()
  File "C:\Users\fcl\.azure\cliextensions\azure-devops\azext_devops\devops_sdk\v5_0\location\location_client.py", line 68, in get_resource_areas
    response = self._send(http_method='GET',
  File "C:\Users\fcl\.azure\cliextensions\azure-devops\azext_devops\devops_sdk\client.py", line 60, in _send
    request = self._create_request_message(http_method=http_method,
  File "C:\Users\fcl\.azure\cliextensions\azure-devops\azext_devops\devops_sdk\client.py", line 105, in _create_request_message
    location = self._get_resource_location(location_id)
  File "C:\Users\fcl\.azure\cliextensions\azure-devops\azext_devops\devops_sdk\client.py", line 135, in _get_resource_location
    Client._locations_cache[self.config.base_url] = self._get_resource_locations(all_host_types=False)
  File "C:\Users\fcl\.azure\cliextensions\azure-devops\azext_devops\devops_sdk\client.py", line 172, in _get_resource_locations
    wrapper = self._base_deserialize('VssJsonCollectionWrapper', response)
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msrest/serialization.py", line 1375, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msrest/serialization.py", line 1554, in _unpack_content
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msrest/pipeline/universal.py", line 226, in deserialize_from_http_generics
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msrest/pipeline/universal.py", line 203, in deserialize_from_text
azure.core.exceptions.DeserializationError: Cannot deserialize content-type: text/html

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

Expected Behavior

Environment Summary

Windows-10-10.0.19044-SP0
Python 3.10.8
Installer: MSI

azure-cli 2.44.1

Extensions:
azure-devops 0.25.0

Dependencies:
msal 1.20.0
azure-mgmt-resource 21.1.0b1

Additional Context

fcl-9 commented 1 year ago

In my case for some reason if I run "az pipelines list" from within a repository cloned from AzDevOps everything works fine however if I run it from another directory that does not come from AzDevOps it does not work at all.

image