Error message::
The SSL connection could not be established, see inner exception.'SocketException: An established connection was aborted by the software in your host machine.
This is the code used to connect to Azure Keyvault from local machine.
public static async Task PrivacyAsync()
{
string Client_Id = "xxxxxxxx";
string Client_Secret = "xxxxxx";
var kvUri = "xxxx";
var client = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(
async (string auth, string res, string scope) =>
{
var authcontext = new AuthenticationContext(auth);
var credential = new ClientCredential(Client_Id, Client_Secret);
AuthenticationResult result = await authcontext.AcquireTokenAsync(res, credential);
if (res == null)
{
throw new InvalidOperationException("token failed");
}
return result.AccessToken;
}
));
var secret = await client.GetSecretAsync(kvUri, "xxxxxx");
Console.WriteLine("secret success full read"+secret.Value);
Console.ReadLine();
//var client = new SecretClient(new Uri(kvUri), new DefaultAzureCredential());
//await client.SetSecretAsync("test0311", "hello");
}
Expected result:
Blob storage connection string value stored into Keyvault secret. I need to fetch blob storage connection string value from Keyvault secret using C# code.