Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Keyvault] az keyvault restore start: Add --key-name to support selective key restore #26907

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/keyvault/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,8 @@ class CLISecurityDomainOperation(str, Enum):
with self.argument_context('keyvault restore start') as c:
c.argument('folder_to_restore', options_list=['--backup-folder'],
help='Name of the blob container which contains the backup')
c.argument('key_name', options_list=['--key-name', '--key'],
help='Name of a single key in the backup. When set, only this key will be restored')

with self.argument_context('keyvault restore start', arg_group='Storage Id') as c:
c.extra('storage_resource_uri', required=False,
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/keyvault/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2157,13 +2157,13 @@ def full_backup(cmd, client, token, storage_resource_uri=None, storage_account_n


def full_restore(cmd, client, token, folder_to_restore, storage_resource_uri=None, storage_account_name=None,
blob_container_name=None, hsm_name=None): # pylint: disable=unused-argument
blob_container_name=None, key_name=None, hsm_name=None): # pylint: disable=unused-argument
storage_account_parameters_check(storage_resource_uri, storage_account_name, blob_container_name)
if not storage_resource_uri:
storage_resource_uri = construct_storage_uri(
cmd.cli_ctx.cloud.suffixes.storage_endpoint, storage_account_name, blob_container_name)
folder_url = '{}/{}'.format(storage_resource_uri, folder_to_restore)
return client.begin_restore(folder_url, token)
return client.begin_restore(folder_url, token, key_name=key_name)
# endregion


Expand Down