title: Error in using await operator within an async lambda expression
body: <p>I am trying to load some arbitrary GPS data (150 million records) into Azure Table storage using Parallel.For and async await. But I am getting the following error in the first await statement:</p>
  
  <blockquote>
    <p>The 'await' operator can only be used within an async lambda expression. Consider marking this lambda expression with the 'async' modifier.</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>private static async Task GenerateGpsPointsForTruckAsync(int counter, CloudTableClient tableClient)
      {
          // Create a dummy VIN
          string vin = counter.ToString("D17");
  
          Random random = new Random();
  
          DateTime start = new DateTime(2010, 1, 1);
          int range = (DateTime.Today - start).Milliseconds;
  
          // Create the batch operation.
          TableBatchOperation batchOperation = new TableBatchOperation();
  
          // Prepare 10 batches of 100 GPS points
          Parallel.For(0, 10, i =&gt;
          {
              for (int j = 0; j &lt; 99; j++)
              {
                  Location location = new Location(vin, start.AddDays(random.Next(range)).ToString());
  
                  location.Coordinates = new GeoCoordinate(random.Next(30, 45), random.Next(75, 100));
  
                  batchOperation.Insert(location);
              }
  
              await Task.Run(async () =&gt; 
              { 
                  await LoadGpsPointsForTruckAsync(tableClient, batchOperation); 
              });
          });
      }
  </code></pre>
  
  <p>I looked at a few solutions on Stack Overflow but they don't seem to be working for me.</p>