Skip to content

2.49 regression: unable to recover deleted certificate using id parameter #26652

@t3mi

Description

@t3mi

Describe the bug

With latest (2.49.0) release its not possible to recover deleted certificate using --id parameter

Related command

az keyvault certificate recover --id https://key vault name.vault.azure.net/deletedcertificates/certificate name

Errors

invalid id: The collection "deletedcertificates" does not match the expected "certificates"

Issue script & Debug output

cli.knack.cli: Command arguments: ['keyvault', 'certificate', 'recover', '--id', 'https://key vault name.vault.azure.net/deletedcertificates/certificate name', '--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 0x7f01b0bceb00>, <function OutputProducer.on_global_arguments at 0x7f01b0b1a710>, <function CLIQuery.on_global_arguments at 0x7f01b094ba30>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'keyvault': ['azure.cli.command_modules.keyvault']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: keyvault 0.009 22 131
cli.azure.cli.core: Total (1) 0.009 22 131
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 22 groups, 131 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : keyvault certificate recover
cli.azure.cli.core: Command table: keyvault certificate recover
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f01afbed750>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/nologin/.azure/commands/2023-06-12.14-08-58.keyvault_certificate_recover.1108894.log'.
az_command_data_logger: command args: keyvault certificate recover --id {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7f01afc0a290>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f01afc33c70>, <function register_cache_arguments..add_cache_arguments at 0x7f01afc33d90>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f01b0b1a7a0>, <function CLIQuery.handle_query_parameter at 0x7f01b094bac0>, <function register_ids_argument..parse_ids_arguments at 0x7f01afc33d00>]
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/home/nologin/.asdf/installs/azure-cli/2.49.0/bin/venv/lib/python3.10/site-packages/knack/invocation.py", line 113, in _validation
self._validate_arg_level(parsed_ns)
File "/home/nologin/.asdf/installs/azure-cli/2.49.0/bin/venv/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 859, in _validate_arg_level
validator(**self._build_kwargs(validator, ns))
File "/home/nologin/.asdf/installs/azure-cli/2.49.0/bin/venv/lib/python3.10/site-packages/azure/cli/command_modules/keyvault/_validators.py", line 686, in _validate
ident = KeyVaultIdentifier(uri=identifier, collection=entity_type + 's')
File "/home/nologin/.asdf/installs/azure-cli/2.49.0/bin/venv/lib/python3.10/site-packages/azure/keyvault/key_vault_id.py", line 218, in init
self._parse(uri, kwargs)
File "/home/nologin/.asdf/installs/azure-cli/2.49.0/bin/venv/lib/python3.10/site-packages/azure/keyvault/key_vault_id.py", line 306, in _parse
raise ValueError('invalid id: The {} "{}" does not match the expected "{}"'.format(prop, id_seg, validation_args[prop_strip]))
ValueError: invalid id: The collection "deletedcertificates" does not match the expected "certificates"

cli.azure.cli.core.azclierror: invalid id: The collection "deletedcertificates" does not match the expected "certificates"
az_command_data_logger: invalid id: The collection "deletedcertificates" does not match the expected "certificates"
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f01afbed990>]
az_command_data_logger: exit code: 2
cli.main: Command ran in 0.554 seconds (init: 0.230, invoke: 0.324)

Expected behavior

Certificate successfully restored

Environment Summary

azure-cli 2.49.0

core 2.49.0
telemetry 1.0.8

Extensions:
blueprint 0.3.1
databricks 0.10.1

Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions