Skip to content

az eventhubs eventhub list incorrect validation #32073

@dariuszparzygnat

Description

@dariuszparzygnat

Describe the bug

I've created a resource group with a eventhub namespace. I want to list all event hubs in the namespace. I run a command to list it, and I'm getting "does not fully match regular expression pattern ", even though the namespace exists.

When I try to run command through az rest get, it works:
az rest --method get --url "https://management.azure.com/subscriptions/11111111-1111-aaaa-aaaa-111111111111/resourceGroups/oooooosrg/providers/Microsoft.EventHub/namespaces/ooooooo/eventhubs?api-version=2024-01-01"

Related command

az eventhubs eventhub list --resource-group oooooosrg --namespace-name ooooooo

Errors

InvalidArgumentValue: --namespace-name: Invalid format: 'ooooooo' does not fully match regular expression pattern '^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$'

Issue script & Debug output

cli.knack.cli: Command arguments: ['eventhubs', 'eventhub', 'list', '--resource-group', 'oooooosrg', '--namespace-name', 'ooooooo', '--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 0x102f20cc0>, <function OutputProducer.on_global_arguments at 0x1036dab60>, <function CLIQuery.on_global_arguments at 0x103718f40>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'eventhubs': ['azure.cli.command_modules.eventhubs']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: eventhubs 0.048 16 27
cli.azure.cli.core: Total (1) 0.048 16 27
cli.azure.cli.core: Loaded 16 groups, 27 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : eventhubs eventhub list
cli.azure.cli.core: Command table: eventhubs eventhub list
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x10460aa20>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/xxx/.azure/commands/2025-09-07.12-29-06.eventhubs_eventhub_list.72496.log'.
az_command_data_logger: command args: eventhubs eventhub list --resource-group {} --namespace-name {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x104668360>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x10466a660>, <function register_cache_arguments..add_cache_arguments at 0x10466a840>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x10466a8e0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x1036dac00>, <function CLIQuery.handle_query_parameter at 0x103718fe0>, <function register_ids_argument..parse_ids_arguments at 0x10466a700>]
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.77.0/libexec/lib/python3.13/site-packages/azure/cli/core/aaz/_command_ctx.py", line 53, in format_args
self.args._schema._fmt(ctx=self, value=self.args)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.77.0/libexec/lib/python3.13/site-packages/azure/cli/core/aaz/_arg_fmt.py", line 402, in call
raise err from err
File "/opt/homebrew/Cellar/azure-cli/2.77.0/libexec/lib/python3.13/site-packages/azure/cli/core/aaz/_arg_fmt.py", line 399, in call
value[field_name] = field_schema._fmt(ctx, value[field_name])
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.77.0/libexec/lib/python3.13/site-packages/azure/cli/core/aaz/_arg_fmt.py", line 56, in call
raise AAZInvalidArgValueError(
f"Invalid format: '{data}' does not fully match regular expression pattern '{self._pattern}'")
azure.cli.core.aaz.exceptions.AAZInvalidArgValueError: InvalidArgumentValue: --namespace-name: Invalid format: 'ooooooo' does not fully match regular expression pattern '^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$'

Expected behavior

Return existing event hubs

Environment Summary

azure-cli 2.77.0

core 2.77.0
telemetry 1.1.0

Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0

Python location '/opt/homebrew/Cellar/azure-cli/2.77.0/libexec/bin/python'

Python (Darwin) 3.13.7 (main, Aug 14 2025, 11:12:11) [Clang 17.0.0 (clang-1700.0.13.3)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botEvent Hubsaz eventhubsService AttentionThis issue is responsible by Azure service team.Similar-IssuebugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions