string resourceId = "https://graph.microsoft.com"; string clientId = "In this example, the AcquireTokenSilent method is not being used, but this method is typically used to get a new access token for a resource without prompting the user for credentials if a valid token already exists. The library being used is Microsoft.IdentityModel.Clients.ActiveDirectory."; string clientSecret = " "; string authority = "https://login.microsoftonline.com/ "; // Create the AuthenticationContext instance var authContext = new AuthenticationContext(authority); // Get an access token using client credentials var clientCredential = new ClientCredential(clientId, clientSecret); var tokenResult = authContext.AcquireTokenAsync(resourceId, clientCredential).Result; // Use the access token to call the Graph API HttpClient httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", tokenResult.AccessToken); HttpResponseMessage response = httpClient.GetAsync("https://graph.microsoft.com/v1.0/me").Result; Console.WriteLine(response.Content.ReadAsStringAsync().Result);