az grafana api-key create is broken
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 64
Description
### 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 [, , ]
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 []
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 [.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 []
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_
Contributor guide
Research direction
Inspect the amg extension entry points azext_amg/__init__.py and _params.py, starting with the import of azure.mgmt.dashboard.models.ZoneRedundancy. Run az grafana api-key create with the reported arguments and verify that the missing-module failure is resolved and the command returns a token.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100