az eventhubs eventhub list incorrect validation
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### 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 [, , ]
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 []
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 [.add_subscription_parameter at 0x104668360>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x10466a660>, .add_cache_arguments at 0x10466a840>, .update_breaking_change_info at 0x10466a8e0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [, , .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_
Contributor guide
Assessment
This issue has not been assessed yet.