title: How to get a list of virtual machines in Azure with c#?
body: <p>I'm trying to get a list of my VMS on Azure using C#. I´ve found this nugget package <code>Microsoft.Azure.Management.Compute</code> but I'm not able to create the client of it. What I´ve tried:</p>
  
  <pre><code> public class CustomLoginCredentials : ServiceClientCredentials
  {
      private string AuthenticationToken { get; set; }
      public override void InitializeServiceClient&lt;T&gt;(ServiceClient&lt;T&gt; client)
      {
          var authenticationContext =
              new AuthenticationContext("https://login.windows.net/{tenantID}");
          var credential = new ClientCredential(clientId: "xxxxx-xxxx-xx-xxxx-xxx", clientSecret: "{clientSecret}");
  
          var result = authenticationContext.AcquireToken(resource: "https://management.core.windows.net/",
              clientCredential: credential);
  
          if (result == null)
          {
              throw new InvalidOperationException("Failed to obtain the JWT token");
          }
  
          AuthenticationToken = result.AccessToken;
      }
      public override async Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken)
      {
          if (request == null)
          {
              throw new ArgumentNullException("request");
          }
  
          if (AuthenticationToken == null)
          {
              throw new InvalidOperationException("Token Provider Cannot Be Null");
          }
  
  
  
          request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", AuthenticationToken);
          request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  
          //request.Version = new Version(apiVersion);
          await base.ProcessHttpRequestAsync(request, cancellationToken);
  
      }
  }
  </code></pre>
  
  <p>But I am getting a compilation error on this class saying that <code>AuthenticationContext</code> namespace could not be found. I can't find about how to create this simple client on docs. </p>