CreateExternalKeyOptions Class

public class CreateExternalKeyOptions
extends CreateKeyOptions

Represents the configurable options to register an external key with Azure Key Vault Managed HSM.

An external key references key material that is owned by an external Hardware Security Module (HSM). Unlike other key types, an external key does not have a KeyType; the material is managed by the external HSM and the Managed HSM stores only a reference to it. External keys are mutually exclusive with a key type, so use createExternalKey(CreateExternalKeyOptions createExternalKeyOptions) (or its asynchronous equivalent createExternalKey(CreateExternalKeyOptions createExternalKeyOptions)) rather than the standard create key operations.

External keys are only supported on Managed HSM configured to use External Key Management (EKM), with service version 2026-04-01 or newer. They are not supported on a standard Key Vault.

Constructor Summary

Constructor Description
CreateExternalKeyOptions(String name, ExternalKey externalKey)

Creates an instance of CreateExternalKeyOptions with name as the key name and externalKey as the reference to the external key material.

Method Summary

Modifier and Type Method and Description
ExternalKey getExternalKey()

Get the reference to the external key material.

CreateExternalKeyOptions setEnabled(Boolean enabled)

Set a value that indicates if the key is enabled.

CreateExternalKeyOptions setExpiresOn(OffsetDateTime expiresOn)

Set the expires UTC time.

CreateExternalKeyOptions setExportable(Boolean exportable)

Set a flag that indicates if the private key can be exported.

CreateExternalKeyOptions setKeyOperations(KeyOperation[] keyOperations)

Set the key operations.

CreateExternalKeyOptions setNotBefore(OffsetDateTime notBefore)

Set the notBefore UTC time.

CreateExternalKeyOptions setReleasePolicy(KeyReleasePolicy releasePolicy)

Set the policy rules under which the key can be exported.

CreateExternalKeyOptions setTags(Map<String,String> tags)

Set the tags to be associated with the key.

Methods inherited from CreateKeyOptions

Methods inherited from java.lang.Object

Constructor Details

CreateExternalKeyOptions

public CreateExternalKeyOptions(String name, ExternalKey externalKey)

Creates an instance of CreateExternalKeyOptions with name as the key name and externalKey as the reference to the external key material.

Parameters:

name - The name of the external key to register.
externalKey - The reference identifying the external key material.

Method Details

getExternalKey

public ExternalKey getExternalKey()

Get the reference to the external key material.

Returns:

The reference to the external key material.

setEnabled

public CreateExternalKeyOptions setEnabled(Boolean enabled)

Set a value that indicates if the key is enabled.

Overrides:

CreateExternalKeyOptions.setEnabled(Boolean enabled)

Parameters:

enabled - The enabled value to set.

Returns:

The updated CreateExternalKeyOptions object.

setExpiresOn

public CreateExternalKeyOptions setExpiresOn(OffsetDateTime expiresOn)

Set the expires UTC time.

Overrides:

CreateExternalKeyOptions.setExpiresOn(OffsetDateTime expiresOn)

Parameters:

expiresOn - The expiry time to set for the key.

Returns:

The updated CreateExternalKeyOptions object.

setExportable

public CreateExternalKeyOptions setExportable(Boolean exportable)

Set a flag that indicates if the private key can be exported.

Overrides:

CreateExternalKeyOptions.setExportable(Boolean exportable)

Parameters:

exportable - A flag that indicates if the private key can be exported.

Returns:

The updated CreateExternalKeyOptions object.

setKeyOperations

public CreateExternalKeyOptions setKeyOperations(KeyOperation[] keyOperations)

Set the key operations.

Overrides:

CreateExternalKeyOptions.setKeyOperations(KeyOperation[] keyOperations)

Parameters:

keyOperations - The key operations to set.

Returns:

The updated CreateExternalKeyOptions object.

setNotBefore

public CreateExternalKeyOptions setNotBefore(OffsetDateTime notBefore)

Set the notBefore UTC time.

Overrides:

CreateExternalKeyOptions.setNotBefore(OffsetDateTime notBefore)

Parameters:

notBefore - The notBefore UTC time to set.

Returns:

The updated CreateExternalKeyOptions object.

setReleasePolicy

public CreateExternalKeyOptions setReleasePolicy(KeyReleasePolicy releasePolicy)

Set the policy rules under which the key can be exported.

Overrides:

CreateExternalKeyOptions.setReleasePolicy(KeyReleasePolicy releasePolicy)

Parameters:

releasePolicy - The policy rules to set.

Returns:

The updated CreateExternalKeyOptions object.

setTags

public CreateExternalKeyOptions setTags(Map<String,String> tags)

Set the tags to be associated with the key.

Overrides:

CreateExternalKeyOptions.setTags(Map<String,String> tags)

Parameters:

tags - The tags to set.

Returns:

The updated CreateExternalKeyOptions object.

Applies to