Skip to content

Cannot list diagnostic settings for default directory #31096

Description

@maratsal

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 [<function CLILogging.on_global_arguments at 0x1006771a0>, <function OutputProducer.on_global_arguments at 0x100b72480>, <function CLIQuery.on_global_arguments at 0x100babc40>]
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 [<function AzCliLogging.init_command_file_logging at 0x102836200>]
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 [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x10286f920>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x1028a9c60>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x1028a9da0>, <function register_upcoming_breaking_change_info.<locals>.update_breaking_change_info at 0x1028a9e40>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x100b72520>, <function CLIQuery.handle_query_parameter at 0x100babce0>, <function register_ids_argument.<locals>.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

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamMonitoraz monitorPossible-SolutionSimilar-Issueact-observability-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions