A high-level interface for managing a vault's keys.
ConstructorKeyClient(vault_url: str, credential: TokenCredential, **kwargs: Any)
Parameters Keyword-Only Parameters Methods backup_key
Back up a key in a protected form useable only by Azure Key Vault.
Requires keys/backup permission.
This is intended to allow copying a key from one vault to another. Both vaults must be owned by the same Azure subscription. Also, backup / restore cannot be performed across geopolitical boundaries. For example, a backup from a vault in a USA region cannot be restored to a vault in an EU region.
begin_delete_keyDelete all versions of a key and its cryptographic material.
Requires keys/delete permission. When this method returns Key Vault has begun deleting the key. Deletion may take several seconds in a vault with soft-delete enabled. This method therefore returns a poller enabling you to wait for deletion to complete.
begin_recover_deleted_keyRecover a deleted key to its latest version. Possible only in a vault with soft-delete enabled.
Requires keys/recover permission.
When this method returns Key Vault has begun recovering the key. Recovery may take several seconds. This method therefore returns a poller enabling you to wait for recovery to complete. Waiting is only necessary when you want to use the recovered key in another operation immediately.
closeClose sockets opened by the client.
Calling this method is unnecessary when using the client as a context manager.
create_ec_keyCreate a new elliptic curve key or, if name
is already in use, create a new version of the key.
Requires the keys/create permission.
create_keyCreate a key or, if name
is already in use, create a new version of the key.
Requires keys/create permission.
create_oct_keyCreate a new octet sequence (symmetric) key or, if name
is in use, create a new version of the key.
Requires the keys/create permission.
create_rsa_keyCreate a new RSA key or, if name
is already in use, create a new version of the key
Requires the keys/create permission.
get_cryptography_clientGets a CryptographyClient for the given key.
get_deleted_keyGet a deleted key. Possible only in a vault with soft-delete enabled.
Requires keys/get permission.
get_keyGet a key's attributes and, if it's an asymmetric key, its public material.
Requires keys/get permission.
get_key_attestationGet a key and its attestation blob.
This method is applicable to any key stored in Azure Key Vault Managed HSM. This operation requires the keys/get permission.
get_key_rotation_policyGet the rotation policy of a Key Vault key.
get_random_bytesGet the requested number of random bytes from a managed HSM.
import_keyImport a key created externally.
Requires keys/import permission. If name
is already in use, the key will be imported as a new version.
List all deleted keys, including the public part of each. Possible only in a vault with soft-delete enabled.
Requires keys/list permission.
list_properties_of_key_versionsList the identifiers and properties of a key's versions.
Requires keys/list permission.
list_properties_of_keysList identifiers and properties of all keys in the vault.
Requires keys/list permission.
purge_deleted_keyPermanently deletes a deleted key. Only possible in a vault with soft-delete enabled.
Performs an irreversible deletion of the specified key, without possibility for recovery. The operation is not available if the recovery_level does not specify 'Purgeable'. This method is only necessary for purging a key before its scheduled_purge_date.
Requires keys/purge permission.
release_keyReleases a key.
The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires the keys/release permission.
restore_key_backupRestore a key backup to the vault.
Requires keys/restore permission.
This imports all versions of the key, with its name, attributes, and access control policies. If the key's name is already in use, restoring it will fail. Also, the target vault must be owned by the same Microsoft Azure subscription as the source vault.
rotate_keyRotate the key based on the key policy by generating a new version of the key.
This operation requires the keys/rotate permission.
send_requestRuns a network request using the client's existing pipeline.
The request URL can be relative to the vault URL. The service API version used for the request is the same as the client's unless otherwise specified. This method does not raise if the response is an error; to raise an exception, call raise_for_status() on the returned response object. For more information about how to send custom requests with this method, see https://aka.ms/azsdk/dpcodegen/python/send_request.
update_key_propertiesChange a key's properties (not its cryptographic material).
Requires keys/update permission.
update_key_rotation_policyUpdates the rotation policy of a Key Vault key.
This operation requires the keys/update permission.
backup_keyBack up a key in a protected form useable only by Azure Key Vault.
Requires keys/backup permission.
This is intended to allow copying a key from one vault to another. Both vaults must be owned by the same Azure subscription. Also, backup / restore cannot be performed across geopolitical boundaries. For example, a backup from a vault in a USA region cannot be restored to a vault in an EU region.
backup_key(name: str, **kwargs: Any) -> bytes
Parameters Returns Exceptions begin_delete_key
Delete all versions of a key and its cryptographic material.
Requires keys/delete permission. When this method returns Key Vault has begun deleting the key. Deletion may take several seconds in a vault with soft-delete enabled. This method therefore returns a poller enabling you to wait for deletion to complete.
begin_delete_key(name: str, **kwargs: Any) -> LROPoller[DeletedKey]
Parameters Returns Exceptions begin_recover_deleted_key
Recover a deleted key to its latest version. Possible only in a vault with soft-delete enabled.
Requires keys/recover permission.
When this method returns Key Vault has begun recovering the key. Recovery may take several seconds. This method therefore returns a poller enabling you to wait for recovery to complete. Waiting is only necessary when you want to use the recovered key in another operation immediately.
begin_recover_deleted_key(name: str, **kwargs: Any) -> LROPoller[KeyVaultKey]
Parameters Returns Exceptions close
Close sockets opened by the client.
Calling this method is unnecessary when using the client as a context manager.
close() -> None
create_ec_key
Create a new elliptic curve key or, if name
is already in use, create a new version of the key.
Requires the keys/create permission.
create_ec_key(name: str, *, curve: str | KeyCurveName | None = None, key_operations: List[str | KeyOperation] | None = None, hardware_protected: bool | None = False, enabled: bool | None = None, tags: Dict[str, str] | None = None, not_before: datetime | None = None, expires_on: datetime | None = None, exportable: bool | None = None, release_policy: KeyReleasePolicy | None = None, **kwargs: Any) -> KeyVaultKey
Parameters Keyword-Only Parameters Returns Exceptions create_key
Create a key or, if name
is already in use, create a new version of the key.
Requires keys/create permission.
create_key(name: str, key_type: str | KeyType, *, size: int | None = None, curve: str | KeyCurveName | None = None, public_exponent: int | None = None, key_operations: List[str | KeyOperation] | None = None, enabled: bool | None = None, tags: Dict[str, str] | None = None, not_before: datetime | None = None, expires_on: datetime | None = None, exportable: bool | None = None, release_policy: KeyReleasePolicy | None = None, **kwargs: Any) -> KeyVaultKey
Parameters Keyword-Only Parameters Returns Exceptions create_oct_key
Create a new octet sequence (symmetric) key or, if name
is in use, create a new version of the key.
Requires the keys/create permission.
create_oct_key(name: str, *, size: int | None = None, key_operations: List[str | KeyOperation] | None = None, hardware_protected: bool | None = False, enabled: bool | None = None, tags: Dict[str, str] | None = None, not_before: datetime | None = None, expires_on: datetime | None = None, exportable: bool | None = None, release_policy: KeyReleasePolicy | None = None, **kwargs: Any) -> KeyVaultKey
Parameters Keyword-Only Parameters Returns Exceptions create_rsa_key
Create a new RSA key or, if name
is already in use, create a new version of the key
Requires the keys/create permission.
create_rsa_key(name: str, *, size: int | None = None, public_exponent: int | None = None, hardware_protected: bool | None = False, key_operations: List[str | KeyOperation] | None = None, enabled: bool | None = None, tags: Dict[str, str] | None = None, not_before: datetime | None = None, expires_on: datetime | None = None, exportable: bool | None = None, release_policy: KeyReleasePolicy | None = None, **kwargs: Any) -> KeyVaultKey
Parameters Keyword-Only Parameters Returns Exceptions get_cryptography_client
Gets a CryptographyClient for the given key.
get_cryptography_client(key_name: str, *, key_version: str | None = None, **kwargs) -> CryptographyClient
Parameters Keyword-Only Parameters Returns get_deleted_key
Get a deleted key. Possible only in a vault with soft-delete enabled.
Requires keys/get permission.
get_deleted_key(name: str, **kwargs: Any) -> DeletedKey
Parameters Returns Exceptions get_key
Get a key's attributes and, if it's an asymmetric key, its public material.
Requires keys/get permission.
get_key(name: str, version: str | None = None, **kwargs: Any) -> KeyVaultKey
Parameters Returns Exceptions get_key_attestation
Get a key and its attestation blob.
This method is applicable to any key stored in Azure Key Vault Managed HSM. This operation requires the keys/get permission.
get_key_attestation(name: str, version: str | None = None, **kwargs: Any) -> KeyVaultKey
Parameters Returns Exceptions get_key_rotation_policy
Get the rotation policy of a Key Vault key.
get_key_rotation_policy(key_name: str, **kwargs: Any) -> KeyRotationPolicy
Parameters Returns Exceptions get_random_bytes
Get the requested number of random bytes from a managed HSM.
get_random_bytes(count: int, **kwargs: Any) -> bytes
Parameters Returns Exceptions import_key
Import a key created externally.
Requires keys/import permission. If name
is already in use, the key will be imported as a new version.
import_key(name: str, key: JsonWebKey, *, hardware_protected: bool | None = None, enabled: bool | None = None, tags: Dict[str, str] | None = None, not_before: datetime | None = None, expires_on: datetime | None = None, exportable: bool | None = None, release_policy: KeyReleasePolicy | None = None, **kwargs: Any) -> KeyVaultKey
Parameters Keyword-Only Parameters Returns Exceptions list_deleted_keys
List all deleted keys, including the public part of each. Possible only in a vault with soft-delete enabled.
Requires keys/list permission.
list_deleted_keys(**kwargs: Any) -> ItemPaged[DeletedKey]
Returns list_properties_of_key_versions
List the identifiers and properties of a key's versions.
Requires keys/list permission.
list_properties_of_key_versions(name: str, **kwargs: Any) -> ItemPaged[KeyProperties]
Parameters Returns list_properties_of_keys
List identifiers and properties of all keys in the vault.
Requires keys/list permission.
list_properties_of_keys(**kwargs: Any) -> ItemPaged[KeyProperties]
Returns purge_deleted_key
Permanently deletes a deleted key. Only possible in a vault with soft-delete enabled.
Performs an irreversible deletion of the specified key, without possibility for recovery. The operation is not available if the recovery_level does not specify 'Purgeable'. This method is only necessary for purging a key before its scheduled_purge_date.
Requires keys/purge permission.
purge_deleted_key(name: str, **kwargs: Any) -> None
Parameters Returns Exceptions Examples
# if the vault has soft-delete enabled, purge permanently deletes a deleted key
# (with soft-delete disabled, begin_delete_key is permanent)
key_client.purge_deleted_key("key-name")
release_key
Releases a key.
The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires the keys/release permission.
release_key(name: str, target_attestation_token: str, *, version: str | None = None, algorithm: str | KeyExportEncryptionAlgorithm | None = None, nonce: str | None = None, **kwargs: Any) -> ReleaseKeyResult
Parameters Keyword-Only Parameters Returns Exceptions restore_key_backup
Restore a key backup to the vault.
Requires keys/restore permission.
This imports all versions of the key, with its name, attributes, and access control policies. If the key's name is already in use, restoring it will fail. Also, the target vault must be owned by the same Microsoft Azure subscription as the source vault.
restore_key_backup(backup: bytes, **kwargs: Any) -> KeyVaultKey
Parameters Returns Exceptions rotate_key
Rotate the key based on the key policy by generating a new version of the key.
This operation requires the keys/rotate permission.
rotate_key(name: str, **kwargs: Any) -> KeyVaultKey
Parameters Returns Exceptions send_request
Runs a network request using the client's existing pipeline.
The request URL can be relative to the vault URL. The service API version used for the request is the same as the client's unless otherwise specified. This method does not raise if the response is an error; to raise an exception, call raise_for_status() on the returned response object. For more information about how to send custom requests with this method, see https://aka.ms/azsdk/dpcodegen/python/send_request.
send_request(request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse
Parameters Keyword-Only Parameters Returns update_key_properties
Change a key's properties (not its cryptographic material).
Requires keys/update permission.
update_key_properties(name: str, version: str | None = None, *, key_operations: List[str | KeyOperation] | None = None, enabled: bool | None = None, tags: Dict[str, str] | None = None, not_before: datetime | None = None, expires_on: datetime | None = None, release_policy: KeyReleasePolicy | None = None, **kwargs: Any) -> KeyVaultKey
Parameters Keyword-Only Parameters Returns Exceptions update_key_rotation_policy
Updates the rotation policy of a Key Vault key.
This operation requires the keys/update permission.
update_key_rotation_policy(key_name: str, policy: KeyRotationPolicy, *, lifetime_actions: List[KeyRotationLifetimeAction] | None = None, expires_in: str | None = None, **kwargs: Any) -> KeyRotationPolicy
Parameters Keyword-Only Parameters Returns Exceptions Attributes
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4