다음을 통해 공유


SecretClient.GetSecretAsync(String, String, CancellationToken) Method

Definition

Get a specified secret from a given key vault.

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