Overview of Batch APIs and tools
Processing parallel workloads with Azure Batch is typically done programmatically by using one of the Batch APIs. Your client application or service can use the Batch APIs to communicate with the Batch service. With the Batch APIs, you can create and manage pools of compute nodes, either virtual machines or cloud services. You can then schedule jobs and tasks to run on those nodes.
You can efficiently process large-scale workloads for your organization, or provide a service front end to your customers so that they can run jobs and tasks—on demand, or on a schedule—on one, hundreds, or even thousands of nodes. You can also use Azure Batch as part of a larger workflow, managed by tools such as Azure Data Factory.
Tip
To learn more about the features and workflow used in Azure Batch, see Batch service workflow and resources.
Azure accounts for Batch development
When you develop Batch solutions, you use the following accounts in your Azure subscription:
- Batch account: Azure Batch resources, including pools, compute nodes, jobs, and tasks, are associated with an Azure Batch account. When your application makes a request against the Batch service, it authenticates the request using the Azure Batch account name, the URL of the account, and either an access key or a Microsoft Entra token. You can create a Batch account in the Azure portal or programmatically.
- Storage account: Batch includes built-in support for working with files in Azure Storage. Nearly every Batch scenario uses Azure Blob storage for staging the programs that your tasks run and the data that they process, and for the storage of output data that they generate. Each Batch account is usually associated with a corresponding storage account.
Service-level and management-level APIs
Azure Batch has two sets of APIs, one for the service level and one for the management level. The naming is often similar, but they return different results.
Only actions from the management APIs are tracked in the activity log. Service level APIs bypass the Azure Resource Management layer (management.chinacloudapi.cn) and are not logged.
For example, the Batch service API to delete a pool is targeted directly on the batch account: DELETE {batchUrl}/pools/{poolId}
Whereas the Batch management API to delete a pool is targeted at the management.chinacloudapi.cn layer: DELETE https://management.chinacloudapi.cn/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}
Batch service APIs
Your applications and services can issue direct REST API calls or use one or more of the following client libraries to run and manage your Azure Batch workloads.
API | API reference | Download | Tutorial | Code samples | More info |
---|---|---|---|---|---|
Batch REST | Azure REST API - Docs | N/A | - | - | Supported versions |
Batch .NET | Azure SDK for .NET - Docs | NuGet | Tutorial | GitHub | Release notes |
Batch Python | Azure SDK for Python - Docs | PyPI | Tutorial | GitHub | Readme |
Batch JavaScript | Azure SDK for JavaScript - Docs | npm | Tutorial | - | Readme |
Batch Java | Azure SDK for Java - Docs | Maven | - | GitHub | Readme |
Batch Management APIs
The Azure Resource Manager APIs for Batch provide programmatic access to Batch accounts. Using these APIs, you can programmatically manage Batch accounts, quotas, application packages, and other resources through the Microsoft.Batch provider.
API | API reference | Download | Tutorial | Code samples |
---|---|---|---|---|
Batch Management REST | Azure REST API - Docs | - | - | GitHub |
Batch Management .NET | Azure SDK for .NET - Docs | NuGet | Tutorial | GitHub |
Batch Management Python | Azure SDK for Python - Docs | PyPI | - | - |
Batch Management JavaScript | Azure SDK for JavaScript - Docs | npm | - | - |
Batch Management Java | Azure SDK for Java - Docs | Maven | - | - |
Batch command-line tools
These command-line tools provide the same functionality as the Batch service and Batch Management APIs:
- Batch PowerShell cmdlets: The Azure Batch cmdlets in the Azure PowerShell module enable you to manage Batch resources with PowerShell.
- Azure CLI: The Azure CLI is a cross-platform toolset that provides shell commands for interacting with many Azure services, including the Batch service and Batch Management service. For more information, see Manage Batch resources with Azure CLI.
Other tools for application development
These additional tools may be helpful for building and debugging your Batch applications and services.
- Azure portal: You can create, monitor, and delete Batch pools, jobs, and tasks in the Azure portal. You can view status information for these and other resources while you run your jobs, and even download files from the compute nodes in your pools. For example, you can download a failed task's
stderr.txt
while troubleshooting. You can also download Remote Desktop (RDP) files that you can use to log in to compute nodes. - Azure Batch Explorer: Batch Explorer is a free, rich-featured, standalone client tool to help create, debug, and monitor Azure Batch applications. Download an installation package for Mac, Linux, or Windows.
- Azure Storage Explorer: While not strictly an Azure Batch tool, the Storage Explorer can be helpful when developing and debugging your Batch solutions.
Additional resources
- For reference information on events raised by the Batch service, see Batch Analytics.
- For information about environment variables for compute nodes, see Azure Batch runtime environment variables.
Next steps
- Learn about the Batch service workflow and primary resources such as pools, nodes, jobs, and tasks.
- Get started with the Azure Batch library for .NET to learn how to use C# and the Batch .NET library to execute a simple workload using a common Batch workflow. A Python version and a JavaScript tutorial are also available.
- Download the code samples on GitHub to see how both C# and Python can interface with Batch to schedule and process sample workloads.