Azure / Azure/azure-cli

az grafana show requires a resource group while az grafana service-account does not

Open
#31,799 2 comments 0 reactions 0 assignees View on GitHub
amg Auto-Assign bug customer-reported Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

`az grafana show --name vromanchuk-test-grafana`

### Related command

I was trying to get a url of a grafana instance in our dashboard deployment script, but it turns out it requires a resource group, while at the same time to create a service account resource group is not required, I was wondering is it possible to call az grafana show without setting resource group

steps to reproduce
az login

az grafana show --name vromanchuk-test-grafana

### Errors

```
InvalidArgumentValue: Missing required field: --resource-group
```

### Issue script & Debug output

az grafana show --name vromanchuk-test-grafana --debug
cli.knack.cli: Command arguments: ['grafana', 'show', '--name', 'vromanchuk-test-grafana', '--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 1.270 13 53 C:\Users\vromanchuk\.azure\cliextensions\amg
cli.azure.cli.core: Total (1) 1.270 13 53
cli.azure.cli.core: Loaded 13 groups, 53 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : grafana show
cli.azure.cli.core: Command table: grafana show
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate []
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\vromanchuk\.azure\commands\2025-07-12.14-31-25.grafana_show.35744.log'.
az_command_data_logger: command args: grafana show --name {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [.add_subscription_parameter at 0x0000028875713740>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x0000028875751F80>, .add_cache_arguments at 0x00000288757520C0>, .update_breaking_change_info at 0x0000028875752160>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [, , .parse_ids_arguments at 0x0000028875752020>]
az_command_data_logger: extension name: amg
az_command_data_logger: extension version: 2.7.0
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command_ctx.py", line 53, in format_args
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_fmt.py", line 415, in __call__
azure.cli.core.aaz.exceptions.AAZInvalidArgValueError: InvalidArgumentValue: Missing required field: --resource-group

During handling of the above exception, another exception occurred:

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 666, in execute
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 734, 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 703, in _run_job
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command.py", line 155, in __call__
File "C:\Users\vromanchuk\.azure\cliextensions\amg\azext_amg\aaz\latest\grafana\_show.py", line 29, in _handler
super()._handler(command_args)
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command.py", line 165, in _handler
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command_ctx.py", line 55, in format_args
azure.cli.core.azclierror.InvalidArgumentValueError: InvalidArgumentValue: Missing required field: --resource-group

cli.azure.cli.core.azclierror: InvalidArgumentValue: Missing required field: --resource-group
az_command_data_logger: InvalidArgumentValue: Missing required field: --resource-group
cli.knack.cli: Event: Cli.PostExecute []
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 2.211 seconds (init: 0.668, invoke: 1.543)
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 3892 in cache file under C:\Users\vromanchuk\.azure\telemetry\20250712143126279
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry\__init__.pyc C:\Users\vromanchuk\.azure C:\Users\vromanchuk\.azure\telemetry\20250712143126279"
telemetry.process: Return from creating process 20564
telemetry.main: Finish creating telemetry upload process.

### Expected behavior

az grafana show works without the need to provide resource group. Or any other workaround to get grafana instance url without resource group

### Environment Summary

azure-cli 2.75.0

core 2.75.0
telemetry 1.1.0

Extensions:
amg 2.7.0
azure-devops 1.0.1

Dependencies:
msal 1.33.0b1
azure-mgmt-resource 23.3.0

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\vromanchuk\.azure'
Extensions directory 'C:\Users\vromanchuk\.azure\cliextensions'

Python (Windows) 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.