Azure / Azure/azure-cli

Cannot list diagnostic settings for default directory

Open
#31,096 2 comments 0 reactions 1 assignee Claimed by @AllyW View on GitHub
act-observability-squad Auto-Assign Azure CLI Team customer-reported Monitor Possible-Solution question Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

When I try to run command below, it doesn't work and throws error.
```
az monitor diagnostic-settings list --resource "/providers/microsoft.aadiam"
```

It is not clear if it's me doing something wrong or is it some bug in the command?

### Related command

`az monitor diagnostic-settings list --resource "/providers/microsoft.aadiam" `

### Errors
```
usage error: --resource ID | --resource NAME --resource-group NAME --resource-type TYPE [--resource-parent PARENT] [--resource-namespace NAMESPACE]
```
### Issue script & Debug output
```
cli.knack.cli: Command arguments: ['monitor', 'diagnostic-settings', 'list', '--resource', '/providers/microsoft.aadiam', '--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 'monitor': ['azure.cli.command_modules.monitor']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: monitor 0.347 24 66
cli.azure.cli.core: Total (1) 0.347 24 66
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 24 groups, 66 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : monitor diagnostic-settings list
cli.azure.cli.core: Command table: monitor diagnostic-settings list
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate []
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/marat.salakhutdinov/.azure/commands/2025-03-20.17-18-20.monitor_diagnostic-settings_list.80535.log'.
az_command_data_logger: command args: monitor diagnostic-settings list --resource {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [.add_subscription_parameter at 0x10286f920>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x1028a9c60>, .add_cache_arguments at 0x1028a9da0>, .update_breaking_change_info at 0x1028a9e40>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [, , .parse_ids_arguments at 0x1028a9d00>]
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.70.0/libexec/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.70.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 666, in execute
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.70.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 734, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.70.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.70.0/libexec/lib/python3.12/site-packages/azure/cli/core/aaz/_command.py", line 155, in __call__
return self._handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.70.0/libexec/lib/python3.12/site-packages/azure/cli/command_modules/monitor/aaz/latest/monitor/diagnostic_settings/_list.py", line 30, in _handler
self._execute_operations()
File "/opt/homebrew/Cellar/azure-cli/2.70.0/libexec/lib/python3.12/site-packages/azure/cli/command_modules/monitor/aaz/latest/monitor/diagnostic_settings/_list.py", line 52, in _execute_operations
self.pre_operations()
File "/opt/homebrew/Cellar/azure-cli/2.70.0/libexec/lib/python3.12/site-packages/azure/cli/command_modules/monitor/operations/diagnostics_settings.py", line 182, in pre_operations
update_resource_parameters(ctx)
File "/opt/homebrew/Cellar/azure-cli/2.70.0/libexec/lib/python3.12/site-packages/azure/cli/command_modules/monitor/operations/diagnostics_settings.py", line 66, in update_resource_parameters
raise usage_error
knack.util.CLIError: usage error: --resource ID | --resource NAME --resource-group NAME --resource-type TYPE [--resource-parent PARENT] [--resource-namespace NAMESPACE]

cli.azure.cli.core.azclierror: usage error: --resource ID | --resource NAME --resource-group NAME --resource-type TYPE [--resource-parent PARENT] [--resource-namespace NAMESPACE]
az_command_data_logger: usage error: --resource ID | --resource NAME --resource-group NAME --resource-type TYPE [--resource-parent PARENT] [--resource-namespace NAMESPACE]
```
### Expected behavior

list diagnostic settings of default directory

### Environment Summary
```
az --version
azure-cli 2.70.0

core 2.70.0
telemetry 1.1.0

Extensions:
account 0.2.5

Dependencies:
msal 1.31.2b1
azure-mgmt-resource 23.1.1

Python location '/opt/homebrew/Cellar/azure-cli/2.70.0/libexec/bin/python'
Config directory '/Users/marat/.azure'
Extensions directory '/Users/marat/.azure/cliextensions'

Python (Darwin) 3.12.9 (main, Feb 4 2025, 14:38:38) [Clang 16.0.0 (clang-1600.0.26.6)]

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.