Share via


SecretClient.GetSecret(String, String, CancellationToken) Method

Definition

Get a specified secret from a given key vault.

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

Parameters

name
String

The name of the secret.

version
String

The version of the secret.

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 get operation is applicable to any secret stored in Azure Key Vault. This operation requires the secrets/get permission.

Applies to