Azure / azure-cli

Azure Command-Line Interface
MIT License
4.02k stars 2.99k forks source link

az appconfig feature set documentation doesn't match the real behavior of az 2.58.0 #28672

Open svaraksin-gd opened 7 months ago

svaraksin-gd commented 7 months ago

Describe the bug

az appconfig feature set -n "appcg-main" --yes --label "test" --key ".appconfig.featureflag/test:test";
ERROR: The feature name derived from the specified key is invalid. Feature name cannot contain the following characters: '%', ':'.

Related command

az appconfig feature set

Errors

ERROR: The feature name derived from the specified key is invalid. Feature name cannot contain the following characters: '%', ':'.

Issue script & Debug output

[APPLY] The feature 'feature1' with the key 'app' will be uploaded/updated.
DEBUG: cli.knack.cli: Command arguments: ['appconfig', 'feature', 'set', '-n', 'appcg-main', '--yes', '--label', 'web-app', '--key', '.appconfig.featureflag/feature1:app', '--debug']
DEBUG: cli.knack.cli: __init__ debug log:
Cannot enable color.
DEBUG: cli.knack.cli: Event: Cli.PreExecute []
DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7ff7dc114040>, <function OutputProducer.on_global_arguments at 0x7ff7dc0ba160>, <function CLIQuery.on_global_arguments at 0x7ff7dc0efc40>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
DEBUG: cli.azure.cli.core: Modules found from index for 'appconfig': ['azure.cli.command_modules.appconfig']
DEBUG: cli.azure.cli.core: Loading command modules:
DEBUG: cli.azure.cli.core: Name                  Load Time    Groups  Commands
DEBUG: cli.azure.cli.core: appconfig                 0.003         9        47
DEBUG: cli.azure.cli.core: Total (1)                 0.003         9        47
DEBUG: cli.azure.cli.core: Loaded 9 groups, 47 commands.
DEBUG: cli.azure.cli.core: Found a match in the command table.
DEBUG: cli.azure.cli.core: Raw command  : appconfig feature set
DEBUG: cli.azure.cli.core: Command table: appconfig feature set
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7ff7dafdd8a0>]
DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/runner/_work/tpl-devops-app-configs/tpl-devops-app-configs/.azure/commands/2024-04-02.02-04-01.appconfig_feature_set.360.log'.
INFO: az_command_data_logger: command args: appconfig feature set -n {} --yes --label {} --key {} --debug
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7ff7dafefe20>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7ff7db04dbc0>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7ff7db04dd00>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7ff7dc0ba200>, <function CLIQuery.handle_query_parameter at 0x7ff7dc0efce0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7ff7db04dc60>]
DEBUG: cli.azure.cli.core.commands.client_factory: Getting management service client client_type=AppConfigurationManagementClient
DEBUG: cli.azure.cli.core.auth.persistence: build_persistence: location='/home/runner/_work/tpl-devops-app-configs/tpl-devops-app-configs/.azure/service_principal_entries.json', encrypt=False
DEBUG: cli.azure.cli.core.auth.persistence: build_persistence: location='/home/runner/_work/tpl-devops-app-configs/tpl-devops-app-configs/.azure/msal_token_cache.json', encrypt=False
DEBUG: cli.azure.cli.core.auth.binary_cache: load: /home/runner/_work/tpl-devops-app-configs/tpl-devops-app-configs/.azure/msal_http_cache.bin
DEBUG: urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
DEBUG: msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/***/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/***/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS[256](https://github.com/***/tpl-devops-app-configs/actions/runs/8516357343/job/23325281188#step:4:258)'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/***/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/***/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/***/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': T
DEBUG: msal.application: Broker enabled? None
DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 729, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 698, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/appconfig/feature.py", line 65, in set_feature
    raise exception
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/appconfig/feature.py", line 62, in set_feature
    validate_feature_flag_name(feature)
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/appconfig/_utils.py", line 218, in validate_feature_flag_name
    raise InvalidArgumentValueError(
azure.cli.core.azclierror.InvalidArgumentValueError: Feature name cannot contain the following characters: '%', ':'.
ERROR: cli.azure.cli.core.azclierror: The feature name derived from the specified key is invalid. Feature name cannot contain the following characters: '%', ':'.
ERROR: az_command_data_logger: The feature name derived from the specified key is invalid. Feature name cannot contain the following characters: '%', ':'.
DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7ff7dafddb20>]
INFO: az_command_data_logger: exit code: 1
INFO: cli.__main__: Command ran in 0.379 seconds (init: 0.180, invoke: 0.199)
INFO: cli.azure.cli.core.decorators: Suppress exception:
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/azure/cli/__main__.py", line 62, in <module>
    raise ex
  File "/opt/az/lib/python3.11/site-packages/azure/cli/__main__.py", line 55, in <module>
    sys.exit(exit_code)
SystemExit: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/decorators.py", line 79, in _wrapped_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/telemetry.py", line 532, in _get_secrets_warning_config
    show_secrets_warning = _get_config().getboolean('clients', 'show_secrets_warning', fallback=None)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/knack/config.py", line 147, in getboolean
    raise ValueError('Not a boolean: {}'.format(val))
ValueError: Not a boolean: None
INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
INFO: telemetry.client: Accumulated 0 events. Flush the clients.
INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
INFO: telemetry.save: Save telemetry record of length 3621 in cache
INFO: telemetry.main: Begin creating telemetry upload process.
INFO: telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.11/site-packages/azure/cli/telemetry/__init__.py /home/runner/_work/tpl-devops-app-configs/tpl-devops-app-configs/.azure"
INFO: telemetry.process: Return from creating process
INFO: telemetry.main: Finish creating telemetry upload process.

Expected behavior

described here https://learn.microsoft.com/en-us/cli/azure/appconfig/feature?view=azure-cli-latest#az-appconfig-feature-set and here https://learn.microsoft.com/en-us/azure/azure-app-configuration/manage-feature-flags

Screenshot_1

Environment Summary

azure-cli 2.58.0

core 2.58.0

telemetry 1.1.0

Dependencies:

msal 1.26.0

azure-mgmt-resource 23.1.0b2

Python location '/opt/az/bin/python3'

Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.11.7 (main, Feb 29 2024, 02:08:19) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

yonzhan commented 7 months ago

Thank you for opening this issue, we will look into it.

svaraksin-gd commented 6 months ago

Any updates on this?