Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

SecretClient.GetSecretAsync Method

Definition

Namespace:
Azure.Security.KeyVault.Secrets
Assembly:
Azure.Security.KeyVault.Secrets.dll
Package:
Azure.Security.KeyVault.Secrets v4.11.0
Source:
SecretClient.cs

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.

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


Feedback

Was this page helpful?