title: How to get azure token using c# client?
body: <p>I am trying to get all vm size name from my Azure account and I am using <a href="https://docs.microsoft.com/en-us/rest/api/compute/virtualmachinesizes/list#code-try-0" rel="nofollow noreferrer">This approach</a>
  In site when I click try out I am getting back result which I need.</p>
  
  <p>Json look like:</p>
  
  <pre><code>{
    "value": [
      {
        "name": "Standard_D1_v2",
        "numberOfCores": 1,
        "osDiskSizeInMB": 1047552,
        "resourceDiskSizeInMB": 51200,
        "memoryInMB": 3584,
        "maxDataDiskCount": 4
      },
      {
        "name": "Standard_D2_v2",
        "numberOfCores": 2,
        "osDiskSizeInMB": 1047552,
        "resourceDiskSizeInMB": 102400,
        "memoryInMB": 7168,
        "maxDataDiskCount": 8
      },
  }
  </code></pre>
  
  <p>And after logged in microsoft gets token and request looks like:</p>
  
  <pre><code>GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/North%20Europe/vmSizes?api-version=2019-12-01
  Authorization: Bearer {{token.....}}
  </code></pre>
  
  <p>I need to get token for making request which I don't know,
  I have credentials like:</p>
  
  <p>azure_client_id
   azure_client_secret
   azure_tenant_id
   azure_subscription_id</p>
  
  <p>Using this credentials how can I achieve this json result, in short how can I get token.</p>
  
  <p>Tried approaches:</p>
  
  <p><a href="https://samlman.wordpress.com/2015/06/04/getting-an-azure-access-token-for-a-web-application-entirely-in-code/" rel="nofollow noreferrer">This one</a> <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/access-tokens" rel="nofollow noreferrer">Read this but no info</a> <a href="https://docs.microsoft.com/en-us/graph/auth-v2-user" rel="nofollow noreferrer">investigated also this one</a> 
   <a href="https://stackoverflow.com/questions/34930835/programmatically-getting-the-list-of-azure-virtual-machine-sizes">also this question in stackoveflow</a></p>
  
  <p>P.S. I am using aspnet core 3.1 web app maybe it is better client for azure. I used ComputeClient but no success. In final I thought using httpclient but first of all I need to test with postman.</p>