title: How to use 1.2 TLS version in .NET for getting authenticated to EWS Server
body: <p>First of am very newbie to C# development and trying to switch the authentication from basic to oauth based one. However while testing below code I got depreciated exception.</p>
  <p>#Implementation</p>
  <pre><code>  // Using Microsoft.Identity.Client
              var cca = ConfidentialClientApplicationBuilder
                  .Create(clientId)      //client Id
                  .WithClientSecret(clientSecret)
                  .WithTenantId(tenantId)
                  .Build();
              var ewsScopes = new string[] { &quot;https://outlook.office365.com/.default&quot; };
              try
              {
                  // Get token
                  var authResult = await cca.AcquireTokenForClient(ewsScopes)
                      .ExecuteAsync();
                  this.token = authResult.AccessToken;
              }
              catch (MsalException ex)
              {
                  Console.WriteLine($&quot;Error acquiring access token: {ex}&quot;);
              }
              catch (Exception ex)
              {
                  Console.WriteLine($&quot;Error: {ex}&quot;);
              }
  </code></pre>
  <p>#Exception</p>
  <pre><code>
  Microsoft.Identity.Client.MsalServiceException
    HResult=0x80131500
    Message=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: 9XXXXXXXXXXXXXXXXXXf. 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.
  Trace ID: 57531a5a-2797-4f77-bc73-11b1e4355800
  Correlation ID: 4295ecdd-7aa1-458f-8e6a-03fda78ec30f
  Timestamp: 2022-07-25 03:32:33Z
    Source=Microsoft.Identity.Client
  </code></pre>
  <p>I tried using <code>ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;</code></p>
  <p>Unfortunately this not working. It would be greatly appreciated if someone could navigate for resolving above exception.</p>