Azure / azure-cli

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

az upgrade --debug provides no useful additional information when there is a failure #30040

Open neel-m opened 2 weeks ago

neel-m commented 2 weeks ago

Describe the bug

For some reason az upgrade is unable to upgrade the ssh and devops extensions on my system. It suggested that add the --debug flag to get more information. Since it is getting a pip failed error, it is likely that there is some conflict that pip can't figure out on its own. With a pip log I might be able to help it. Of course, it really should be using a venv to keep its requirements from getting messed up by whatever I have my default set up configured to do.

Related command

az upgrade

Errors

az upgrade This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus You already have the latest azure-cli version: 2.64.0 Upgrading extensions Default enabled including preview versions for extension installation now. Disabled in future release. Use '--allow-preview-extensions true' to enable it specifically if needed. Use '--allow-preview-extensions false' to install stable version only. Checking update for azure-devops An error occurred whilst updating. An error occurred. Pip failed with status code 1. Use --debug for more information. Failed to update. Rolled azure-devops back to 0.18.0. Checking update for bastion Checking update for ssh An error occurred whilst updating. An error occurred. Pip failed with status code 1. Use --debug for more information. Failed to update. Rolled ssh back to 1.1.2. Checking update for storage-preview An error occurred whilst updating. An error occurred. Pip failed with status code 1. Use --debug for more information. Failed to update. Rolled storage-preview back to 0.8.3. Upgrade finished.You can enable auto-upgrade with 'az config set auto-upgrade.enable=yes'. More details in https://docs.microsoft.com/cli/azure/update-azure-cli#automatic-update

Issue script & Debug output

PS C:> az upgrade --debug cli.knack.cli: Command arguments: ['upgrade', '--debug'] cli.knack.cli: init debug log: Enable color in terminal. cli.knack.cli: Event: Cli.PreExecute [] cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x0182FA78>, <function OutputProducer.on_global_arguments at 0x01B55B68>, <function CLIQuery.on_global_arguments at 0x01B78938>] cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] cli.azure.cli.core: Modules found from index for 'upgrade': ['azure.cli.command_modules.util'] cli.azure.cli.core: Loading command modules: cli.azure.cli.core: Name Load Time Groups Commands cli.azure.cli.core: util 0.014 3 7 cli.azure.cli.core: Total (1) 0.014 3 7 cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next'] cli.azure.cli.core: Loading extensions: cli.azure.cli.core: Name Load Time Groups Commands Directory cli.azure.cli.core: Total (0) 0.000 0 0 cli.azure.cli.core: Loaded 3 groups, 7 commands. cli.azure.cli.core: Found a match in the command table. cli.azure.cli.core: Raw command : upgrade cli.azure.cli.core: Command table: upgrade cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x038C0438>] cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\neelm.azure\commands\2024-10-07.16-29-21.upgrade.27024.log'. az_command_data_logger: command args: upgrade --debug cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x038FF8E8>] cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x038FF9D8>, <function register_cache_arguments..add_cache_arguments at 0x03924C58>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x03924CA8>] cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x01B55BB8>, <function CLIQuery.handle_query_parameter at 0x01B78988>, <function register_ids_argument..parse_ids_arguments at 0x03924C08>] This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus urllib3.connectionpool: Starting new HTTPS connection (1): raw.githubusercontent.com:443 urllib3.connectionpool: https://raw.githubusercontent.com:443 "GET /Azure/azure-cli/main/src/azure-cli/setup.py HTTP/1.1" 200 2517 cli.azure.cli.command_modules.util.custom: You already have the latest azure-cli version: 2.64.0 cli.azure.cli.command_modules.util.custom: Upgrading extensions cli.azure.cli.command_modules.util.custom: Default enabled including preview versions for extension installation now. Disabled in future release. Use '--allow-preview-extensions true' to enable it specifically if needed. Use '--allow-preview-extensions false' to install stable version only. cli.azure.cli.command_modules.util.custom: Checking update for azure-devops An error occurred whilst updating. An error occurred. Pip failed with status code 1. Use --debug for more information. Failed to update. Rolled azure-devops back to 0.18.0. cli.azure.cli.command_modules.util.custom: Checking update for bastion Latest version of 'bastion' is already installed.

Use --debug for more information cli.azure.cli.command_modules.util.custom: Checking update for ssh An error occurred whilst updating. An error occurred. Pip failed with status code 1. Use --debug for more information. Failed to update. Rolled ssh back to 1.1.2. cli.azure.cli.command_modules.util.custom: Checking update for storage-preview An error occurred whilst updating. An error occurred. Pip failed with status code 1. Use --debug for more information. Failed to update. Rolled storage-preview back to 0.8.3. cli.azure.cli.command_modules.util.custom: Upgrade finished.You can enable auto-upgrade with 'az config set auto-upgrade.enable=yes'. More details in https://docs.microsoft.com/cli/azure/update-azure-cli#automatic-update cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x038FF208>, <function _x509_from_base64_to_hex_transform at 0x038FF258>] cli.knack.cli: Event: CommandInvoker.OnFilterResult [] cli.knack.cli: Event: Cli.SuccessfulExecute [] cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x038C0578>] az_command_data_logger: exit code: 0 cli.main: Command ran in 122.503 seconds (init: 0.722, invoke: 121.780) telemetry.main: Begin splitting cli events and extra events, total events: 1 telemetry.client: Accumulated 0 events. Flush the clients. telemetry.main: Finish splitting cli events and extra events, cli events: 1 telemetry.save: Save telemetry record of length 3573 in cache file under C:\Users\neelm.azure\telemetry\20241007163123649 telemetry.main: Begin creating telemetry upload process. telemetry.process: Creating upload process: "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry__init__.pyc C:\Users\neelm.azure C:\Users\neelm.azure\telemetry\20241007163123649" telemetry.process: Return from creating process 78508 telemetry.main: Finish creating telemetry upload process.

Expected behavior

az upgrade just works! when I tell it --debug and an error occurs with pip, print the error message

Environment Summary

azure-cli 2.64.0

core 2.64.0 telemetry 1.1.0

Extensions: azure-devops 0.18.0 bastion 1.3.0 ssh 1.1.2 storage-preview 0.8.3

Dependencies: msal 1.30.0 azure-mgmt-resource 23.1.1

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' Extensions directory 'C:\Users\neelm.azure\cliextensions'

Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 21:52:07) [MSC v.1937 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

yonzhan commented 2 weeks ago

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

github-actions[bot] commented 2 weeks ago

Here are some similar issues that might help you. Please check if they can solve your problem.

neel-m commented 2 weeks ago

And the reason why the command failed is my PAT had expired so pip (likely) got an authentication error. This likely would have been in the pip error log. Once I updated the pip config to use a new PAT for authentication, az upgrade worked fine.