I am trying to read the values from Azure Key vault using below code, but it always throws below exception at first time and second time it just runs fine.
As it is System.ExecutionEngineException: 'Exception of type 'System.ExecutionEngineException' was thrown.'
No way to handle it(at least I am aware).
My code looks like:
private Dictionary<string, string> GetCredentials()
{
string tenantId = "<TenantId>";
string clientId = "<ClientId>";
string clientSecret = "<ClientSecret>";
string vaultUrl ="<VaultUrl>";
SecretClient secretClient = new SecretClient(
new Uri(vaultUrl),
new ClientSecretCredential(tenantId, clientId, clientSecret)
);
var UserName = secretClient.GetSecret("UserName");
var Password = secretClient.GetSecret("Password");
var result = new Dictionary<string, string>
{
{UserName.Value.Value, Password.Value.Value}
};
return result;
}