Interface IKeyVaultService
Interface that handles the Azure Key Vault integration. This interface is used by the KeyVaultService class. The KeyVaultService class is used to fetch secrets from Azure Key Vault. This interface offers both synchronous and asynchronous methods for fetching secrets from Azure Key Vault.
public interface IKeyVaultService
Methods
TryGetSecret(string)
Fetches a Key Vault secret by name synchronously. When using this method, the thread will be blocked until the secret is fetched. For asynchronous fetching, use the TryGetSecretAsync(string) method.
string TryGetSecret(string secretName)
Parameters
secretName
stringThe name of the secret to fetch from Azure Key Vault.
Returns
- string
The value of the secret.
TryGetSecretAsync(string)
Fetches a Key Vault secret by name asynchronously. When using this method, the thread will not be blocked until the secret is fetched. For synchronous fetching, use the TryGetSecret(string) method.
Task<string> TryGetSecretAsync(string secretName)
Parameters
secretName
stringThe name of the secret to fetch from Azure Key Vault.