-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[Key Vault] Add External Key Manager (EKM) support for Managed HSM (Preview) #33651
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
Open
notyashhh
wants to merge
5
commits into
dev
Choose a base branch
from
yash/ekm-hsm-public-preview
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+796
−31
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4c7d5a2
[Key Vault] Add External Key Manager (EKM) support for Managed HSM (P…
notyashhh 014f06b
[Key Vault] EKM: address review feedback (fail-fast on incompatible k…
notyashhh a5a504c
[Key Vault] EKM: add live scenario test for connection + external key…
notyashhh ed1bf78
[Key Vault] EKM: make live scenario test runnable (path-prefix + clea…
notyashhh 597275c
[Key Vault] EKM: make --server-ca-certificate required on create; ver…
notyashhh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ | |
| from azure.cli.command_modules.keyvault._validators import ( | ||
| datetime_type, certificate_type, validate_retention_days_on_creation, | ||
| get_vault_base_url_type, get_hsm_base_url_type, validate_key_import_type, | ||
| validate_key_import_source, validate_key_type, validate_policy_permissions, validate_principal, | ||
| validate_key_import_source, validate_policy_permissions, validate_principal, | ||
| validate_resource_group_name, validate_x509_certificate_chain, | ||
| secret_text_encoding_values, secret_binary_encoding_values, validate_subnet, validate_ip_address, | ||
| validate_vault_or_hsm, | ||
|
|
@@ -356,10 +356,13 @@ class CLISecurityDomainOperation(str, Enum): | |
| 'Release policies are mutable by default.') | ||
|
|
||
| with self.argument_context('keyvault key create') as c: | ||
| c.argument('kty', arg_type=get_enum_type(JsonWebKeyType), validator=validate_key_type, | ||
| c.argument('kty', arg_type=get_enum_type(JsonWebKeyType), | ||
| help='The type of key to create. For valid values, see: https://learn.microsoft.com/rest/api/keyvault/keys/create-key/create-key#jsonwebkeytype') | ||
| c.argument('curve', arg_type=get_enum_type(KeyCurveName), | ||
| help='Elliptic curve name. For valid values, see: https://learn.microsoft.com/rest/api/keyvault/keys/create-key/create-key#jsonwebkeycurvename') | ||
| c.extra('external_key_id', options_list=['--external-key-id'], arg_group='External Key', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does .extra do differently from .argument? |
||
| is_preview=True, | ||
| help='Create an external Managed HSM key backed by an External Key Manager (EKM) key id.') | ||
|
|
||
| with self.argument_context('keyvault key import') as c: | ||
| c.argument('kty', arg_type=get_enum_type(CLIKeyTypeForBYOKImport), validator=validate_key_import_type, | ||
|
|
@@ -616,6 +619,49 @@ class CLISecurityDomainOperation(str, Enum): | |
| help='Target operation that needs waiting.') | ||
| # endregion | ||
|
|
||
| # region keyvault ekm-connection | ||
| for scope in ['create', 'update', 'show', 'check', 'delete']: | ||
| with self.argument_context('keyvault ekm-connection {}'.format(scope), arg_group='HSM Id') as c: | ||
| c.extra('hsm_name', hsm_url_type, required=False, | ||
| help='Name of the HSM. Can be omitted if --id is specified.') | ||
| c.extra('identifier', options_list=['--id'], validator=validate_vault_or_hsm, | ||
| help='Full URI of the HSM.') | ||
| c.ignore('vault_base_url') | ||
|
|
||
| with self.argument_context('keyvault ekm-connection create', arg_group='EKM Connection') as c: | ||
| c.argument('host', options_list=['--host'], required=True, | ||
| help='EKM proxy host (FQDN or FQDN:port). If port is omitted, 443 is assumed.') | ||
| c.extra('path_prefix', options_list=['--path-prefix'], | ||
| help='Optional path prefix to append to EKM proxy requests. Must start with "/".') | ||
| c.extra('server_ca_certificates', options_list=['--server-ca-certificate'], nargs='+', type=file_type, | ||
| required=True, completer=FilesCompleter(), | ||
| help='Path(s) to server CA certificate(s) in PEM or DER format. ' | ||
| 'Pass a single file containing a PEM chain (multiple certificate blocks), ' | ||
| 'or multiple space-separated file paths (each PEM or DER).') | ||
| c.extra('server_subject_common_name', options_list=['--server-subject-common-name', '--server-cn'], | ||
| help='Optional expected Common Name (CN) for the EKM proxy server certificate.') | ||
|
|
||
| with self.argument_context('keyvault ekm-connection update', arg_group='EKM Connection') as c: | ||
| c.argument('host', options_list=['--host'], required=False, | ||
| help='EKM proxy host (FQDN or FQDN:port). If port is omitted, 443 is assumed.') | ||
| c.extra('path_prefix', options_list=['--path-prefix'], | ||
| help='Optional path prefix to append to EKM proxy requests. Must start with "/".') | ||
| c.extra('server_ca_certificates', options_list=['--server-ca-certificate'], nargs='+', type=file_type, | ||
| completer=FilesCompleter(), | ||
| help='Path(s) to server CA certificate(s) in PEM or DER format. ' | ||
| 'Pass a single file containing a PEM chain (multiple certificate blocks), ' | ||
| 'or multiple space-separated file paths (each PEM or DER).') | ||
| c.extra('server_subject_common_name', options_list=['--server-subject-common-name', '--server-cn'], | ||
| help='Optional expected Common Name (CN) for the EKM proxy server certificate.') | ||
|
|
||
| with self.argument_context('keyvault ekm-connection certificate show', arg_group='HSM Id') as c: | ||
| c.extra('hsm_name', hsm_url_type, required=False, | ||
| help='Name of the HSM. Can be omitted if --id is specified.') | ||
| c.extra('identifier', options_list=['--id'], validator=validate_vault_or_hsm, | ||
| help='Full URI of the HSM.') | ||
| c.ignore('vault_base_url') | ||
| # endregion | ||
|
|
||
| # region keyvault backup/restore | ||
| for item in ['backup', 'restore']: | ||
| for scope in ['start']: # TODO add 'status' when SDK is ready | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removing the validator?