Issue connecting to Azure Key Vault using C# - For Getting Certificate

Ppat 1 Reputation point Microsoft Vendor
2022-09-29T16:02:23.757+00:00

Hello,

I have created a certificate in Azure Key Vault and trying to get the certificate using my C# MVC application and getting following error. I have added my web application to Key Vault access policy priniciple. I am using Azure AAD to sign in to my application.

{"error":"invalid_request","error_description":"AADSTS1002016:
You are using TLS version 1.0, 1.1 and/or 3DES cipher which are deprecated to improve the security posture of Azure AD.
Your TenantID is: xyz-xyz-xyz.
Please refer to https://go.microsoft.com/fwlink/?linkid=2161187 and conduct needed actions to remediate the issue.
For further questions, please contact your administrator.

Here is my code for getting certificate.

static KeyVaultClient GetClient() => new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(async (string authority, string resource, string scope) =>  
{  
    var context = new AuthenticationContext(authority, TokenCache.DefaultShared);  
    ClientCredential clientCred = new ClientCredential(CLIENT_ID, CLIENT_SECRET);  
    var authResult = await context.AcquireTokenAsync(resource, clientCred);  
    return authResult.AccessToken;  
}));  
  
var Client = GetClient();  
var Certificate = Client.GetCertificateAsync(CERTIFICATE_IDENTIFIER).GetAwaiter().GetResult();  

Any help here much appreciated! Please let me know if anyone needs any more information.

Thanks

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,116 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,247 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,877 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MINGYU BAK 76 Reputation points
    2022-09-30T06:54:54.607+00:00

    migrate .NET Framework version support to tls1.2 or higher

    0 comments No comments