Skip to content

Service connection name requirement is inconsistent with other resources by disallowing - #30268

@benjaminapetersen

Description

@benjaminapetersen

Describe the bug

Referencing this doc, a quick example command to illustrate what I am doing right now:

az aks connection create keyvault \
    --connection oh-no-hyphen-is-not-allowed-now \ 
    --resource-group my-rg-akv-on-aks \
    --name my-akv-on-aks-with-sscsi \
    --target-resource-group my-rg-akv-on-aks \
    --vault my-akv-on-aks-with-sscsi \
    --enable-csi \
    --client-type none

Hyphens have been allowed for all the objects I have created thus far (Resource Groups, Clusters, Key Vaults, etc) but a Service Connection requires breaking my pattern due to hyphen disallow.

Related command

az aks connection create keyvault --connection oh-no-hyphen-is-not-allowed-now

Errors

Resource name can only contain letters (A-Z, a-z), numbers (0-9), periods ('.'), and underscores ('_')

Issue script & Debug output

az aks connection create keyvault --connection akv-on-aks-with-sscsi --resource-group my-rg-akv-on-aks --name akv-on-aks-with-sscsi --target-resource-group my-rg-akv-on-aks --vault akv-on-aks-with-sscsi --enable-csi --client-type none --debug
cli.knack.cli: Command arguments: ['aks', 'connection', 'create', 'keyvault', '--connection', 'akv-on-aks-with-sscsi', '--resource-group', 'my-rg-akv-on-aks', '--name', 'akv-on-aks-with-sscsi', '--target-resource-group', 'my-rg-akv-on-aks', '--vault', 'akv-on-aks-with-sscsi', '--enable-csi', '--client-type', 'none', '--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 0x1057b0720>, <function OutputProducer.on_global_arguments at 0x105ea2fc0>, <function CLIQuery.on_global_arguments at 0x105ee0ae0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'aks': ['azure.cli.command_modules.acs', 'azure.cli.command_modules.serviceconnector']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: acs 0.604 14 77
cli.azure.cli.core: serviceconnector 0.100 20 309
cli.azure.cli.core: Total (2) 0.704 34 386
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 33 groups, 386 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : aks connection create keyvault
cli.azure.cli.core: Command table: aks connection create keyvault
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x122d73740>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/benjaminpetersen/.azure/commands/2024-11-06.11-18-58.aks_connection_create_keyvault.22678.log'.
az_command_data_logger: command args: aks connection create keyvault --connection {} --resource-group {} --name {} --target-resource-group {} --vault {} --enable-csi --client-type {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x122dc2700>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x122e0c9a0>, <function register_cache_arguments..add_cache_arguments at 0x122e0cae0>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x122e0cb80>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x105ea3060>, <function CLIQuery.handle_query_parameter at 0x105ee0b80>, <function register_ids_argument..parse_ids_arguments at 0x122e0ca40>]
Command group 'aks connection' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
cli.azure.cli.core.decorators: Suppress exception:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.65.0_2/libexec/lib/python3.11/site-packages/azure/cli/core/decorators.py", line 79, in _wrapped_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
TypeError: set_exception() missing 1 required positional argument: 'fault_type'

cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.65.0_2/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.65.0_2/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 654, in execute
self._validation(expanded_arg)
File "/opt/homebrew/Cellar/azure-cli/2.65.0_2/libexec/lib/python3.11/site-packages/knack/invocation.py", line 113, in _validation
self._validate_arg_level(parsed_ns)
File "/opt/homebrew/Cellar/azure-cli/2.65.0_2/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 921, in _validate_arg_level
validator(**self._build_kwargs(validator, ns))
File "/opt/homebrew/Cellar/azure-cli/2.65.0_2/libexec/lib/python3.11/site-packages/azure/cli/command_modules/serviceconnector/_validators.py", line 910, in validate_params
validate_connection_name(namespace.connection_name)
File "/opt/homebrew/Cellar/azure-cli/2.65.0_2/libexec/lib/python3.11/site-packages/azure/cli/command_modules/serviceconnector/validators.py", line 698, in validate_connection_name
raise e
azure.cli.core.azclierror.InvalidArgumentValueError: Resource name can only contain letters (A-Z, a-z), numbers (0-9), periods ('.'), and underscores ('
')

cli.azure.cli.core.azclierror: Resource name can only contain letters (A-Z, a-z), numbers (0-9), periods ('.'), and underscores ('')
az_command_data_logger: Resource name can only contain letters (A-Z, a-z), numbers (0-9), periods ('.'), and underscores ('
')
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x122d739c0>]
az_command_data_logger: exit code: 1
cli.main: Command ran in 2.850 seconds (init: 1.181, invoke: 1.669)

Expected behavior

Connection should be created allowing the hyphens in name for consistency with other resources.

Environment Summary

az --version
azure-cli 2.65.0

core 2.65.0
telemetry 1.1.0

Extensions:
interactive 1.0.0b1
scenario-guide 0.1.1

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1

Python location '/opt/homebrew/Cellar/azure-cli/2.65.0_2/libexec/bin/python'
Extensions directory '/Users/someuser/.azure/cliextensions'

Python (Darwin) 3.11.10 (main, Sep 7 2024, 01:03:31) [Clang 16.0.0 (clang-1600.0.26.3)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

Thanks! 🐶

Metadata

Metadata

Assignees

No one assigned

    Labels

    AKSaz aks/acs/openshiftAuto-AssignAuto assign by botService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions