private EncryptionKey QueryEncryptionKey(string secretId) { var task = Task.Run(async() => { try { var val = (await _client.GetSecretAsync(_keyVaultUrl, secretId)).Value; return(val); } catch (Exception ex) { EventManager.KeyVaultFailed("GetSecretAsync", ex); return(null); } }); task.Wait(_maxWaitTimeout); if (string.IsNullOrWhiteSpace(task.Result)) { return(null); } return(EncryptionKey.FromByteArray(Convert.FromBase64String(task.Result))); }