SecretClient.SetSecretAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
SetSecretAsync(KeyVaultSecret, CancellationToken) |
Sets a secret in a specified key vault. |
SetSecretAsync(String, String, CancellationToken) |
Sets a secret in a specified key vault. |
SetSecretAsync(KeyVaultSecret, CancellationToken)
- Source:
- SecretClient.cs
- Source:
- SecretClient.cs
Sets a secret in a specified key vault.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret>> SetSecretAsync (Azure.Security.KeyVault.Secrets.KeyVaultSecret secret, System.Threading.CancellationToken cancellationToken = default);
abstract member SetSecretAsync : Azure.Security.KeyVault.Secrets.KeyVaultSecret * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret>>
override this.SetSecretAsync : Azure.Security.KeyVault.Secrets.KeyVaultSecret * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret>>
Public Overridable Function SetSecretAsync (secret As KeyVaultSecret, Optional cancellationToken As CancellationToken = Nothing) As Task(Of 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
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
SetSecretAsync(String, String, CancellationToken)
- Source:
- SecretClient.cs
- Source:
- SecretClient.cs
Sets a secret in a specified key vault.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret>> SetSecretAsync (string name, string value, System.Threading.CancellationToken cancellationToken = default);
abstract member SetSecretAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret>>
override this.SetSecretAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret>>
Public Overridable Function SetSecretAsync (name As String, value As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of KeyVaultSecret))
Parameters
- name
- String
The name of the secret. It must not be null.
- value
- String
The value of the secret. It must not be null.
- cancellationToken
- CancellationToken
A CancellationToken controlling the request lifetime.
Returns
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.