SecretClient.SetSecret Method

Definition

Overloads

SetSecret(KeyVaultSecret, CancellationToken)

Sets a secret in a specified key vault.

SetSecret(String, String, CancellationToken)

Sets a secret in a specified key vault.

SetSecret(KeyVaultSecret, CancellationToken)

Sets a secret in a specified key vault.

public virtual Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret> SetSecret (Azure.Security.KeyVault.Secrets.KeyVaultSecret secret, System.Threading.CancellationToken cancellationToken = default);
abstract member SetSecret : Azure.Security.KeyVault.Secrets.KeyVaultSecret * System.Threading.CancellationToken -> Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret>
override this.SetSecret : Azure.Security.KeyVault.Secrets.KeyVaultSecret * System.Threading.CancellationToken -> Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret>
Public Overridable Function SetSecret (secret As KeyVaultSecret, Optional cancellationToken As CancellationToken = Nothing) As Response(Of KeyVaultSecret)

Parameters

secret
KeyVaultSecret

The Secret object containing information about the secret and its properties. The properties secret.Name and secret.Value must be non null.

cancellationToken
CancellationToken

A CancellationToken controlling the request lifetime.

Returns

Response<KeyVaultSecret>

Exceptions

secret is null.

The server returned an error. See Message for details returned from the server.

Remarks

The set operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key Vault creates a new version of that secret. This operation requires the secrets/set permission.

Applies to

SetSecret(String, String, CancellationToken)

Sets a secret in a specified key vault.

public virtual Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret> SetSecret (string name, string value, System.Threading.CancellationToken cancellationToken = default);
abstract member SetSecret : string * string * System.Threading.CancellationToken -> Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret>
override this.SetSecret : string * string * System.Threading.CancellationToken -> Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret>
Public Overridable Function SetSecret (name As String, value As String, Optional cancellationToken As CancellationToken = Nothing) As Response(Of KeyVaultSecret)

Parameters

name
String

The name of the secret.

value
String

The value of the secret.

cancellationToken
CancellationToken

A CancellationToken controlling the request lifetime.

Returns

Response<KeyVaultSecret>

Exceptions

name is an empty string.

name is null.

The server returned an error. See Message for details returned from the server.

Remarks

The set operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key Vault creates a new version of that secret. This operation requires the secrets/set permission.

Applies to