Skip to content

Conversation

@aupetit-ms
Copy link
Contributor

@aupetit-ms aupetit-ms commented Nov 27, 2025

Related command
az eventhubs eventhub create
az eventhubs eventhub delete
az eventhubs eventhub list
az eventhubs eventhub show
az eventhubs eventhub update
az eventhubs namespace create
az eventhubs namespace delete
az eventhubs namespace failover
az eventhubs namespace show
az eventhubs namespace update
az eventhubs namespace wait
az eventhubs namespace nsp-configuration list
az eventhubs namespace nsp-configuration show

Description
2 issues have been reported (#31108 and #32073) regarding the argument --namespace-name. This argument has a min length defined at 6 and max at 50. But the regular expression provided to the pattern property doesn't match the min and max lengths.

For example with a --namespace-name value with a length equals to 7:
az eventhubs namespace nsp-configuration list --namespace-name abc1234
InvalidArgumentValue: --namespace-name: Invalid format: 'abc1234' does not fully match regular expression pattern '^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$'

The current regular expression min length is 8 and max 52.

Before:

fmt=AAZStrArgFormat(
                pattern="^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$",
                max_length=50,
                min_length=6,
            ),

To fix it, I modified it to have at the end a min at 6 and max at 50.

After:

fmt=AAZStrArgFormat(
                pattern="^[a-zA-Z][a-zA-Z0-9-]{4,48}[a-zA-Z0-9]$",
                max_length=50,
                min_length=6,
            ),

Testing Guide

There are 3 tests to perform:

  • with a --namespace-name value length less than 6.
  • with a --namespace-name value length equals to 6.
  • a --namespace-name value length more than 6.

Before fix, with a --namespace-name value length equals to 6:
az eventhubs eventhub list --namespace-name abc123
InvalidArgumentValue: --namespace-name: Invalid format: 'abc123' does not fully match regular expression pattern '^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$'

After fix, with a --namespace-name value length equals to 6 (message expected because this resource doesn't exist):
az eventhubs eventhub list --namespace-name abc123
(ParentResourceNotFound) Failed to perform 'read' on resource(s) of type 'namespaces/eventhubs', because the parent resource '/subscriptions/.../resourceGroups/.../providers/Microsoft.EventHub/namespaces/abc123' could not be found. Code: ParentResourceNotFound Message: Failed to perform 'read' on resource(s) of type 'namespaces/eventhubs', because the parent resource '/subscriptions/.../resourceGroups/.../providers/Microsoft.EventHub/namespaces/abc123' could not be found.


This checklist is used to make sure that common guidelines for a pull request are followed.

@aupetit-ms aupetit-ms requested a review from jsntcy as a code owner November 27, 2025 08:41
Copilot AI review requested due to automatic review settings November 27, 2025 08:41
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Nov 27, 2025

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@yonzhan
Copy link
Collaborator

yonzhan commented Nov 27, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Nov 27, 2025

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@github-actions
Copy link

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes validation issues (#31108 and #32073) with the --namespace-name argument in EventHubs commands. The regex pattern was incorrectly enforcing a minimum length of 8 and maximum of 52, while the documented constraints specify a minimum of 6 and maximum of 50 characters.

Key Changes:

  • Updated regex pattern from ^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$ to ^[a-zA-Z][a-zA-Z0-9-]{4,48}[a-zA-Z0-9]$
  • This aligns the pattern with the declared min_length=6 and max_length=50 constraints
  • Applied consistently across all 13 affected command files

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/nsp_configuration/_show.py Updated namespace name validation pattern for nsp-configuration show command
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/nsp_configuration/_list.py Updated namespace name validation pattern for nsp-configuration list command
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/_wait.py Updated namespace name validation pattern for namespace wait command
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/_update.py Updated namespace name validation pattern for namespace update command
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/_show.py Updated namespace name validation pattern for namespace show command
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/_failover.py Updated namespace name validation pattern for namespace failover command
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/_delete.py Updated namespace name validation pattern for namespace delete command
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/_create.py Updated namespace name validation pattern for namespace create command
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/_update.py Updated namespace name validation pattern for eventhub update command
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/_show.py Updated namespace name validation pattern for eventhub show command
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/_list.py Updated namespace name validation pattern for eventhub list command
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/_delete.py Updated namespace name validation pattern for eventhub delete command
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/_create.py Updated namespace name validation pattern for eventhub create command

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Event Hubs az eventhubs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants