如何使用 .NET API 列出 Azure Batch 帐户中的所有任务?

How to list all tasks in an Azure Batch account using the .NET API?

在我的 Azure Batch 帐户中,我同时 运行 多个作业。我怎样才能获得所有工作的所有任务?

使用BatchClient.JobOperations's ListJobs() and ListTasks():

using Microsoft.Azure.Batch;
using Microsoft.Azure.Batch.Auth;
/*...*/

var BatchClient = BatchClient.Open(new BatchSharedKeyCredentials(
  "<your-batch-endpoint>", 
  "<your-batch-account-name>", 
  "<your-shared-key>"));
var jobs = BatchClient.JobOperations.ListJobs();
var tasks = jobs.SelectMany(job => BatchClient.JobOperations.ListTasks(job.Id));