Condividi tramite


SecretClient.GetSecretAsync 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, Azure.Security.KeyVault.Secrets.SecretContentType? outContentType = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetSecretAsync : string * string * Nullable<Azure.Security.KeyVault.Secrets.SecretContentType> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Secrets.KeyVaultSecret>>
override this.GetSecretAsync : string * string * Nullable<Azure.Security.KeyVault.Secrets.SecretContentType> * 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 outContentType As Nullable(Of SecretContentType) = 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.

outContentType
Nullable<SecretContentType>

The content type in which the certificate will be returned. If a supported format is specified, the certificate content is converted to the requested format. Currently, only PFX to PEM conversion is supported. If an unsupported format is specified, the request is rejected. If not specified, the certificate is returned in its original format without conversion.

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