Share via


KeyVaultClientExtensions.SetSecretAsync Method

Definition

Sets a secret in a specified key vault.

public static System.Threading.Tasks.Task<Microsoft.Azure.KeyVault.Models.SecretBundle> SetSecretAsync (this Microsoft.Azure.KeyVault.IKeyVaultClient operations, string vaultBaseUrl, string secretName, string value, System.Collections.Generic.IDictionary<string,string> tags = default, string contentType = default, Microsoft.Azure.KeyVault.Models.SecretAttributes secretAttributes = default, System.Threading.CancellationToken cancellationToken = default);
static member SetSecretAsync : Microsoft.Azure.KeyVault.IKeyVaultClient * string * string * string * System.Collections.Generic.IDictionary<string, string> * string * Microsoft.Azure.KeyVault.Models.SecretAttributes * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.KeyVault.Models.SecretBundle>
<Extension()>
Public Function SetSecretAsync (operations As IKeyVaultClient, vaultBaseUrl As String, secretName As String, value As String, Optional tags As IDictionary(Of String, String) = Nothing, Optional contentType As String = Nothing, Optional secretAttributes As SecretAttributes = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of SecretBundle)

Parameters

operations
IKeyVaultClient

The operations group for this extension method.

vaultBaseUrl
String

The vault name, for example https://myvault.vault.azure.net.

secretName
String

The name of the secret.

value
String

The value of the secret.

tags
IDictionary<String,String>

Application specific metadata in the form of key-value pairs.

contentType
String

Type of the secret value such as a password.

secretAttributes
SecretAttributes

The secret management attributes.

cancellationToken
CancellationToken

The cancellation token.

Returns

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