Azure / azure-cli

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

az grafana api-key create is broken #28585

Open aeimer opened 6 months ago

aeimer commented 6 months ago

Describe the bug

Creating an api-key for Grafana is broken via az cli.

Related command

az grafana api-key create

Errors

The command failed with an unexpected error. Here is the traceback: No module named 'azure.mgmt.dashboard' Traceback (most recent call last): File "/opt/homebrew/Cellar/azure-cli/2.58.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.58.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 562, in execute self.commands_loader.load_arguments(command) File "/opt/homebrew/Cellar/azure-cli/2.58.0/libexec/lib/python3.11/site-packages/azure/cli/core/init.py", line 522, in load_arguments loader.load_arguments(command) # this adds entries to the argument registries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/a.eimer/.azure/cliextensions/amg/azext_amg/init.py", line 28, in load_arguments load_arguments(self, command) File "/Users/a.eimer/.azure/cliextensions/amg/azext_amg/_params.py", line 14, in load_arguments from azure.mgmt.dashboard.models import ZoneRedundancy ModuleNotFoundError: No module named 'azure.mgmt.dashboard' To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Issue script & Debug output

cli.knack.cli: Command arguments: ['grafana', 'api-key', 'create', '--key', 'keyname', '--name', 'foo', '--resource-group', 'bar', '--role', 'editor', '--output', 'json', '--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 0x101a451c0>, <function OutputProducer.on_global_arguments at 0x101af4360>, <function CLIQuery.on_global_arguments at 0x101b21e40>] cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] cli.azure.cli.core: Modules found from index for 'grafana': ['azext_amg'] cli.azure.cli.core: Loading command modules: cli.azure.cli.core: Name Load Time Groups Commands cli.azure.cli.core: Total (0) 0.000 0 0 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: amg 0.080 9 45 /Users/a.eimer/.azure/cliextensions/amg cli.azure.cli.core: Total (1) 0.080 9 45 cli.azure.cli.core: Loaded 9 groups, 45 commands. cli.azure.cli.core: Found a match in the command table. cli.azure.cli.core: Raw command : grafana api-key create cli.azure.cli.core: Command table: grafana api-key create cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x10285eac0>] cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/a.eimer/.azure/commands/2024-03-19.16-09-19.grafana_api-key_create.51836.log'. az_command_data_logger: command args: grafana api-key create --key {} --name {} --resource-group {} --role {} --output {} --debug cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x10288d580>] cli.azure.cli.core.azclierror: Traceback (most recent call last): File "/opt/homebrew/Cellar/azure-cli/2.58.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.58.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 562, in execute self.commands_loader.load_arguments(command) File "/opt/homebrew/Cellar/azure-cli/2.58.0/libexec/lib/python3.11/site-packages/azure/cli/core/init.py", line 522, in load_arguments loader.load_arguments(command) # this adds entries to the argument registries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/a.eimer/.azure/cliextensions/amg/azext_amg/init.py", line 28, in load_arguments load_arguments(self, command) File "/Users/a.eimer/.azure/cliextensions/amg/azext_amg/_params.py", line 14, in load_arguments from azure.mgmt.dashboard.models import ZoneRedundancy ModuleNotFoundError: No module named 'azure.mgmt.dashboard'

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: No module named 'azure.mgmt.dashboard' Traceback (most recent call last): File "/opt/homebrew/Cellar/azure-cli/2.58.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.58.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 562, in execute self.commands_loader.load_arguments(command) File "/opt/homebrew/Cellar/azure-cli/2.58.0/libexec/lib/python3.11/site-packages/azure/cli/core/init.py", line 522, in load_arguments loader.load_arguments(command) # this adds entries to the argument registries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/a.eimer/.azure/cliextensions/amg/azext_amg/init.py", line 28, in load_arguments load_arguments(self, command) File "/Users/a.eimer/.azure/cliextensions/amg/azext_amg/_params.py", line 14, in load_arguments from azure.mgmt.dashboard.models import ZoneRedundancy ModuleNotFoundError: No module named 'azure.mgmt.dashboard' az_command_data_logger: No module named 'azure.mgmt.dashboard' Traceback (most recent call last): File "/opt/homebrew/Cellar/azure-cli/2.58.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.58.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 562, in execute self.commands_loader.load_arguments(command) File "/opt/homebrew/Cellar/azure-cli/2.58.0/libexec/lib/python3.11/site-packages/azure/cli/core/init.py", line 522, in load_arguments loader.load_arguments(command) # this adds entries to the argument registries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/a.eimer/.azure/cliextensions/amg/azext_amg/init.py", line 28, in load_arguments load_arguments(self, command) File "/Users/a.eimer/.azure/cliextensions/amg/azext_amg/_params.py", line 14, in load_arguments from azure.mgmt.dashboard.models import ZoneRedundancy ModuleNotFoundError: No module named 'azure.mgmt.dashboard' To check existing issues, please visit: https://github.com/Azure/azure-cli/issues cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x10285ed40>] az_command_data_logger: exit code: 1 cli.main: Command ran in 0.198 seconds (init: 0.091, invoke: 0.107) 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 7578 in cache telemetry.main: Begin creating telemetry upload process. telemetry.process: Creating upload process: "/opt/homebrew/Cellar/azure-cli/2.58.0/libexec/bin/python /opt/homebrew/Cellar/azure-cli/2.58.0/libexec/lib/python3.11/site-packages/azure/cli/telemetry/init.py /Users/a.eimer/.azure" telemetry.process: Return from creating process telemetry.main: Finish creating telemetry upload process.

Expected behavior

The call should give a token.

Environment Summary

az --version azure-cli 2.58.0

core 2.58.0 telemetry 1.1.0

Extensions: account 0.2.5 amg 1.3.1

Dependencies: msal 1.26.0 azure-mgmt-resource 23.1.0b2

Python location '/opt/homebrew/Cellar/azure-cli/2.58.0/libexec/bin/python' Extensions directory '/Users/a.eimer/.azure/cliextensions'

Python (Darwin) 3.11.8 (main, Feb 6 2024, 21:21:21) [Clang 15.0.0 (clang-1500.1.0.2.5)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

yonzhan commented 6 months ago

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

ABZhang0 commented 5 months ago

Looking into this now, appears to be a package import problem with Mac/homebrew.

ABZhang0 commented 5 months ago

Hi @aeimer, I've found the root cause - it's a dependency problem that's specific to Homebrew, and I'm working on getting the fix out now. In the meantime, if needed, you can unblock by not using Homebrew. I'll let you know once the fix is in.

ABZhang0 commented 5 months ago

@aeimer the newest version of the Azure CLI AMG extension (1.3.2) should fix the issue you're running into.

aeimer commented 5 months ago

Looks good, thank you :)