title: Using authProvider with MS SDK for graph calls in C#
body: <p>I'm trying create a C# console application to connect to graph API and get a list of users from AzureAD from a tenant. I have registered the app and the admin has given me the following</p>
  
  <ul>
  <li>Tenant Name and Tenant ID</li>
  <li>Client ID (also sometimes called App Id)</li>
  <li>Client Secret</li>
  </ul>
  
  <p>Using the sdk the C# code I need to use looks like this (<a href="https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&amp;tabs=cs" rel="noreferrer">https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&amp;tabs=cs</a>):</p>
  
  <pre><code>GraphServiceClient graphClient = new GraphServiceClient( authProvider );
  
  var users = await graphClient.Users
      .Request()
      .GetAsync();
  </code></pre>
  
  <p>However, the console application will run as a batch process so there will be no user interaction at all. So in order to provide the authProvider I followed this article on MS docs site: <a href="https://docs.microsoft.com/en-us/graph/sdks/choose-authentication-providers?tabs=CS" rel="noreferrer">https://docs.microsoft.com/en-us/graph/sdks/choose-authentication-providers?tabs=CS</a></p>
  
  <p>And I think for my purpose I need to go for the "Client Credential OAuth flow". The code which is shown on that URL. But here it is too.</p>
  
  <pre><code>IConfidentialClientApplication clientApplication = ClientCredentialProvider.CreateClientApplication(clientId, clientCredential);
  ClientCredentialProvider authProvider = new ClientCredentialProvider(clientApplication);
  </code></pre>
  
  <p>The trouble is that Visual Studio does not recognise ClientCredentialProvider class. I'm not sure which assembly to import. I'm using the following usings in the top.</p>
  
  <pre><code>using Microsoft.Identity.Client;
  using Microsoft.IdentityModel.Clients;
  using Microsoft.IdentityModel;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  </code></pre>
  
  <p>I'm not very experienced with GitHub repos and I'm using Visual Studio 2015. I would be interested in sample code; I have looked but cannot find any. MS have some lectures but they use another type of auth Provider which is authenticating interactively which is not what I'm looking for. I want obtain the token using the TenantId/ClientId and Client Secret.</p>