Sprache

SecretClient Class

Definition

The SecretClient provides synchronous and asynchronous methods to manage KeyVaultSecret in the Azure Key Vault. The client supports creating, retrieving, updating, deleting, purging, backing up, restoring, and listing KeyVaultSecret. The client also supports listing DeletedSecret for a soft-delete enabled Azure Key Vault.

public class SecretClient
public class SecretClient : IDisposable
type SecretClient = class
type SecretClient = class
    interface IDisposable
Public Class SecretClient
Public Class SecretClient
Implements IDisposable
Inheritance
SecretClient
Implements

Remarks

Internally, all transport — request building, response parsing, paging, model (de)serialization, and LRO polling — is delegated to the TypeSpec-generated KeyVaultSecretsClient (internal). Public method signatures, return types, exception contracts and recorded HTTP traffic match every previously shipped version of this package. Reuse clients and call Dispose() when their lifetime ends. The legacy hand-written transport (KeyVaultPipeline, SecretBackup, JSON read/write methods on the model classes) is no longer invoked.

Constructors

Name Description
SecretClient()

For mocking.

SecretClient(SecretClientSettings)

Initializes a new instance of the SecretClient class from settings.

SecretClient(Uri, TokenCredential, SecretClientOptions)

Initializes a new instance of the SecretClient class.

SecretClient(Uri, TokenCredential)

Initializes a new instance of the SecretClient class.

Properties

Name Description
VaultUri

The vault URI used to construct this client.

Methods

Name Description
BackupSecret(String, CancellationToken)

Backs up the specified secret.

BackupSecretAsync(String, CancellationToken)

Backs up the specified secret.

Dispose()

Releases the HTTP pipeline resources owned by this client.

GetDeletedSecret(String, CancellationToken)

Gets the specified deleted secret.

GetDeletedSecretAsync(String, CancellationToken)

Gets the specified deleted secret.

GetDeletedSecrets(CancellationToken)

Lists deleted secrets for the specified vault.

GetDeletedSecretsAsync(CancellationToken)

Lists deleted secrets for the specified vault.

GetPropertiesOfSecrets(CancellationToken)

Lists the properties of all enabled and disabled secrets in the specified vault. You can use the returned Name in subsequent calls to GetSecret(String, String, Nullable<SecretContentType>, CancellationToken).

GetPropertiesOfSecretsAsync(CancellationToken)

Lists the properties of all enabled and disabled secrets in the specified vault. You can use the returned Name in subsequent calls to GetSecretAsync(String, String, Nullable<SecretContentType>, CancellationToken).

GetPropertiesOfSecretVersions(String, CancellationToken)

Lists the properties of all enabled and disabled versions of the specified secret. You can use the returned Name and Version in subsequent calls to GetSecret(String, String, Nullable<SecretContentType>, CancellationToken).

GetPropertiesOfSecretVersionsAsync(String, CancellationToken)

Lists the properties of all enabled and disabled versions of the specified secret. You can use the returned Name and Version in subsequent calls to GetSecretAsync(String, String, Nullable<SecretContentType>, CancellationToken).

GetSecret(String, String, Nullable<SecretContentType>, CancellationToken)

Get a specified secret from a given key vault.

GetSecretAsync(String, String, Nullable<SecretContentType>, CancellationToken)

Get a specified secret from a given key vault.

PurgeDeletedSecret(String, CancellationToken)

Permanently deletes the specified secret.

PurgeDeletedSecretAsync(String, CancellationToken)

Permanently deletes the specified secret.

RestoreSecretBackup(Byte[], CancellationToken)

Restores a backed up secret to a vault.

RestoreSecretBackupAsync(Byte[], CancellationToken)

Restores a backed up secret to a vault.

SetSecret(KeyVaultSecret, CancellationToken)

Sets a secret in a specified key vault.

SetSecret(String, String, CancellationToken)

Sets a secret in a specified key vault.

SetSecretAsync(KeyVaultSecret, CancellationToken)

Sets a secret in a specified key vault.

SetSecretAsync(String, String, CancellationToken)

Sets a secret in a specified key vault.

StartDeleteSecret(String, CancellationToken)

Deletes a secret from a specified key vault.

StartDeleteSecretAsync(String, CancellationToken)

Deletes a secret from a specified key vault.

StartRecoverDeletedSecret(String, CancellationToken)

Recovers the deleted secret to the latest version.

StartRecoverDeletedSecretAsync(String, CancellationToken)

Recovers the deleted secret to the latest version.

UpdateSecretProperties(SecretProperties, CancellationToken)

Updates the attributes associated with a specified secret.

UpdateSecretPropertiesAsync(SecretProperties, CancellationToken)

Updates the attributes associated with a specified secret.

Applies to