title: Method invocation failed [Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext] does not contain a method named 'AcquireTokenAsync
body: <p>it is not reading the values in authcontext, not sure why, can some help me out with this. using latest version of ADAL v5.2.9</p>
  <p>PowerShell</p>
  <pre><code>           
  function Get-AccessToken
  {​
      $tenantID = &quot;&lt;id&gt;&quot; 
      $AuthUri = &quot;https://login.microsoftonline.com/$tenantID&quot;    
      ########
      #SPN IDs.....
      #spn
      $AppId = &quot;&quot;
      #######
      # SPN cert thumbprints.......
      #spn
      $clientCertificate = Get-Item -Path Cert:\CurrentUser\My\&lt;cert thumb&gt;
      $resource = &quot;&lt;RestApi&gt;&quot;
      $adal = &quot;&lt;path to the dll&gt;\Microsoft.IdentityModel.Clients.ActiveDirectory.dll&quot;
      [System.Reflection.Assembly]::LoadFrom($adal) | Out-Null
      $authenticationContext = New-Object -TypeName Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext -ArgumentList $AuthUri
      $certificateCredential = New-Object -TypeName Microsoft.IdentityModel.Clients.ActiveDirectory.ClientAssertionCertificate -ArgumentList ($AppId, $clientCertificate)
      $authToken = $authenticationContext.AcquireTokenAsync($resource, $certificateCredential)
      $accessToken = $authToken.Result.AccessToken.Trim()
      $authToken.Result.AccessToken.Trim() | Clip
      Write-Host &quot;Token length&quot;
      Write-Host $accessToken.Length
      $accessToken
  }​
  #endregion
  # Get access token, headers and body
  $token = Get-AccessToken
      
  
  </code></pre>
  <p>getting following error</p>
  <pre><code>InvalidOperation: C:\Users\Ipaws-api.ps1:17
  Line |
    17 |     $authToken = $authContext.AcquireTokenAsync($resource, $certificat …
       |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       | Method invocation failed because [Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext] does not
       | contain a method named 'AcquireTokenAsync'.
      
   
  </code></pre>