Compute Node - List

Lists the Compute Nodes in the specified Pool.

GET {batchUrl}/pools/{poolId}/nodes?api-version=2023-11-01.18.0
GET {batchUrl}/pools/{poolId}/nodes?$filter={$filter}&$select={$select}&maxresults={maxresults}&timeout={timeout}&api-version=2023-11-01.18.0

URI Parameters

Name In Required Type Description
batchUrl
path True

string

The base URL for all Azure Batch service requests.

poolId
path True

string

The ID of the Pool from which you want to list Compute Nodes.

api-version
query True

string

Client API Version.

$filter
query

string

An OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-nodes-in-a-pool.

$select
query

string

An OData $select clause.

maxresults
query

integer

int32

The maximum number of items to return in the response. A maximum of 1000 Compute Nodes can be returned.

timeout
query

integer

int32

The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds.

Request Header

Media Types: "application/json; odata=minimalmetadata"

Name Required Type Description
client-request-id

string

uuid

The caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.

return-client-request-id

boolean

Whether the server should return the client-request-id in the response.

ocp-date

string

date-time-rfc1123

The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.

Responses

Name Type Description
200 OK

ComputeNodeListResult

A response containing the list of Compute Nodes.

Headers

  • client-request-id: string
  • request-id: string
  • ETag: string
  • Last-Modified: string
Other Status Codes

BatchError

The error from the Batch service.

Security

azure_auth

Microsoft Entra OAuth 2.0 auth code flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation Impersonate your user account

Authorization

Type: apiKey
In: header

Examples

Node list

Sample Request

GET account.region.batch.azure.com/pools/poolId/nodes?api-version=2023-11-01.18.0


Sample Response

{
  "value": [
    {
      "id": "tvm-1695681911_1-20161122t193202z",
      "url": "https://account.region.batch.azure.com/pools/poolId/nodes/tvm-1695681911_1-20161122t193202z",
      "state": "idle",
      "schedulingState": "enabled",
      "stateTransitionTime": "2016-11-22T22:22:27.2236818Z",
      "lastBootTime": "2016-11-22T22:22:24.4634125Z",
      "allocationTime": "2016-11-22T19:32:02.8155319Z",
      "ipAddress": "1.1.1.1",
      "affinityId": "TVM:tvm-1695681911_1-20161122t193202z",
      "vmSize": "small",
      "totalTasksRun": 0,
      "totalTasksSucceeded": 0,
      "runningTasksCount": 0,
      "runningTaskSlotsCount": 0,
      "isDedicated": true,
      "startTask": {
        "commandLine": "cmd /c echo hello",
        "userIdentity": {
          "autoUser": {
            "scope": "task",
            "elevationLevel": "nonadmin"
          }
        },
        "maxTaskRetryCount": 0,
        "waitForSuccess": false
      },
      "startTaskInfo": {
        "state": "completed",
        "startTime": "2016-11-22T22:22:27.2236818Z",
        "endTime": "2016-11-22T22:22:27.567189Z",
        "exitCode": 0,
        "retryCount": 0
      },
      "nodeAgentInfo": {
        "version": "1.2.0.0",
        "lastUpdateTime": "2016-11-22T22:22:24.4634125Z"
      }
    },
    {
      "id": "tvm-1695681911_2-20161122t193202z",
      "url": "https://account.region.batch.azure.com/pools/poolId/nodes/tvm-1695681911_2-20161122t193202z",
      "state": "idle",
      "schedulingState": "enabled",
      "stateTransitionTime": "2016-11-22T19:37:31.4285526Z",
      "lastBootTime": "2016-11-22T19:37:28.623369Z",
      "allocationTime": "2016-11-22T19:32:02.8155319Z",
      "ipAddress": "1.1.1.1",
      "affinityId": "TVM:tvm-1695681911_2-20161122t193202z",
      "vmSize": "small",
      "totalTasksRun": 0,
      "totalTasksSucceeded": 0,
      "runningTasksCount": 0,
      "runningTaskSlotsCount": 0,
      "isDedicated": true,
      "startTask": {
        "commandLine": "cmd /c echo hello",
        "userIdentity": {
          "autoUser": {
            "scope": "task",
            "elevationLevel": "nonadmin"
          }
        },
        "maxTaskRetryCount": 0,
        "waitForSuccess": false
      },
      "startTaskInfo": {
        "state": "completed",
        "startTime": "2016-11-22T19:37:31.4285526Z",
        "endTime": "2016-11-22T19:37:31.838028Z",
        "exitCode": 0,
        "retryCount": 0
      },
      "nodeAgentInfo": {
        "version": "1.2.0.0",
        "lastUpdateTime": "2016-11-22T22:22:24.4634125Z"
      }
    },
    {
      "id": "tvm-1695681911_3-20161122t193202z",
      "url": "https://account.region.batch.azure.com/pools/poolId/nodes/tvm-1695681911_3-20161122t193202z",
      "state": "idle",
      "schedulingState": "enabled",
      "stateTransitionTime": "2016-11-22T19:36:51.0013378Z",
      "lastBootTime": "2016-11-22T19:36:48.21721Z",
      "allocationTime": "2016-11-22T19:32:02.8155319Z",
      "ipAddress": "1.1.1.1",
      "affinityId": "TVM:tvm-1695681911_3-20161122t193202z",
      "vmSize": "small",
      "totalTasksRun": 0,
      "totalTasksSucceeded": 0,
      "runningTasksCount": 0,
      "runningTaskSlotsCount": 0,
      "isDedicated": true,
      "startTask": {
        "commandLine": "cmd /c echo hello",
        "userIdentity": {
          "autoUser": {
            "scope": "task",
            "elevationLevel": "nonadmin"
          }
        },
        "maxTaskRetryCount": 0,
        "waitForSuccess": false
      },
      "startTaskInfo": {
        "state": "completed",
        "startTime": "2016-11-22T19:36:51.0013378Z",
        "endTime": "2016-11-22T19:36:51.2363447Z",
        "exitCode": 0,
        "retryCount": 0
      },
      "nodeAgentInfo": {
        "version": "1.2.0.0",
        "lastUpdateTime": "2016-11-22T22:22:24.4634125Z"
      }
    }
  ]
}

Definitions

Name Description
AutoUserScope

The scope for the auto user

AutoUserSpecification

Specifies the parameters for the auto user that runs a Task on the Batch service.

BatchError

An error response received from the Azure Batch service.

BatchErrorDetail

An item of additional information included in an Azure Batch error response.

CertificateReference

A reference to a Certificate to be installed on Compute Nodes in a Pool.

CertificateStoreLocation

The location of the Certificate store on the Compute Node into which to install the Certificate.

CertificateVisibility

Which user Accounts on the Compute Node should have access to the private data of the Certificate.

ComputeNode

A Compute Node in the Batch service.

ComputeNodeEndpointConfiguration

The endpoint configuration for the Compute Node.

ComputeNodeError

An error encountered by a Compute Node.

ComputeNodeIdentityReference

The reference to a user assigned identity associated with the Batch pool which a compute node will use.

ComputeNodeListResult

The result of listing the Compute Nodes in a Pool.

ComputeNodeState

The current state of the Compute Node.

ContainerRegistry

A private container registry.

ContainerWorkingDirectory

The location of the container Task working directory.

ElevationLevel

The elevation level of the user.

EnvironmentSetting

An environment variable to be set on a Task process.

ErrorCategory

The category of the error.

ErrorMessage

An error message received in an Azure Batch error response.

ImageReference

A reference to an Azure Virtual Machines Marketplace Image or a Azure Compute Gallery Image. To get the list of all Azure Marketplace Image references verified by Azure Batch, see the 'List Supported Images' operation.

InboundEndpoint

An inbound endpoint on a Compute Node.

InboundEndpointProtocol

The protocol of the endpoint.

NameValuePair

Represents a name-value pair.

NodeAgentInformation

Information about the Compute Node agent.

ResourceFile

A single file or multiple files to be downloaded to a Compute Node.

SchedulingState

Whether the Compute Node is available for Task scheduling.

StartTask

A Task which is run when a Node joins a Pool in the Azure Batch service, or when the Compute Node is rebooted or reimaged.

StartTaskInformation

Information about a StartTask running on a Compute Node.

StartTaskState

The state of the StartTask on the Compute Node.

TaskContainerExecutionInformation

Contains information about the container which a Task is executing.

TaskContainerSettings

The container settings for a Task.

TaskExecutionInformation

Information about the execution of a Task.

TaskExecutionResult

The result of Task execution.

TaskFailureInformation

Information about a Task failure.

TaskInformation

Information about a Task running on a Compute Node.

TaskState

The state of the Task.

UserIdentity

The definition of the user identity under which the Task is run.

VirtualMachineInfo

Info about the current state of the virtual machine.

AutoUserScope

The scope for the auto user

Name Type Description
pool

string

Specifies that the Task runs as the common auto user Account which is created on every Compute Node in a Pool.

task

string

Specifies that the service should create a new user for the Task.

AutoUserSpecification

Specifies the parameters for the auto user that runs a Task on the Batch service.

Name Type Description
elevationLevel

ElevationLevel

The elevation level of the auto user.
The default value is nonAdmin.

scope

AutoUserScope

The scope for the auto user
The default value is pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by StartTasks.

BatchError

An error response received from the Azure Batch service.

Name Type Description
code

string

An identifier for the error. Codes are invariant and are intended to be consumed programmatically.

message

ErrorMessage

A message describing the error, intended to be suitable for display in a user interface.

values

BatchErrorDetail[]

A collection of key-value pairs containing additional details about the error.

BatchErrorDetail

An item of additional information included in an Azure Batch error response.

Name Type Description
key

string

An identifier specifying the meaning of the Value property.

value

string

The additional information included with the error response.

CertificateReference

A reference to a Certificate to be installed on Compute Nodes in a Pool.

Name Type Description
storeLocation

CertificateStoreLocation

The location of the Certificate store on the Compute Node into which to install the Certificate.
The default value is currentuser. This property is applicable only for Pools configured with Windows Compute Nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows Image reference). For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory.

storeName

string

The name of the Certificate store on the Compute Node into which to install the Certificate.
This property is applicable only for Pools configured with Windows Compute Nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows Image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My.

thumbprint

string

The thumbprint of the Certificate.

thumbprintAlgorithm

string

The algorithm with which the thumbprint is associated. This must be sha1.

visibility

CertificateVisibility[]

Which user Accounts on the Compute Node should have access to the private data of the Certificate.
You can specify more than one visibility in this collection. The default is all Accounts.

CertificateStoreLocation

The location of the Certificate store on the Compute Node into which to install the Certificate.

Name Type Description
currentuser

string

Certificates should be installed to the CurrentUser Certificate store.

localmachine

string

Certificates should be installed to the LocalMachine Certificate store.

CertificateVisibility

Which user Accounts on the Compute Node should have access to the private data of the Certificate.

Name Type Description
remoteuser

string

The Certificate should be visible to the user accounts under which users remotely access the Compute Node.

starttask

string

The Certificate should be visible to the user account under which the StartTask is run. Note that if AutoUser Scope is Pool for both the StartTask and a Task, this certificate will be visible to the Task as well.

task

string

The Certificate should be visible to the user accounts under which Job Tasks are run.

ComputeNode

A Compute Node in the Batch service.

Name Type Description
affinityId

string

An identifier which can be passed when adding a Task to request that the Task be scheduled on this Compute Node.
Note that this is just a soft affinity. If the target Compute Node is busy or unavailable at the time the Task is scheduled, then the Task will be scheduled elsewhere.

allocationTime

string

The time at which this Compute Node was allocated to the Pool.
This is the time when the Compute Node was initially allocated and doesn't change once set. It is not updated when the Compute Node is service healed or preempted.

certificateReferences

CertificateReference[]

The list of Certificates installed on the Compute Node.
For Windows Nodes, the Batch service installs the Certificates to the specified Certificate store and location. For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory.

Warning: This property is deprecated and will be removed after February, 2024. Please use the Azure KeyVault Extension instead.

endpointConfiguration

ComputeNodeEndpointConfiguration

The endpoint configuration for the Compute Node.

errors

ComputeNodeError[]

The list of errors that are currently being encountered by the Compute Node.

id

string

The ID of the Compute Node.
Every Compute Node that is added to a Pool is assigned a unique ID. Whenever a Compute Node is removed from a Pool, all of its local files are deleted, and the ID is reclaimed and could be reused for new Compute Nodes.

ipAddress

string

The IP address that other Nodes can use to communicate with this Compute Node.
Every Compute Node that is added to a Pool is assigned a unique IP address. Whenever a Compute Node is removed from a Pool, all of its local files are deleted, and the IP address is reclaimed and could be reused for new Compute Nodes.

isDedicated

boolean

Whether this Compute Node is a dedicated Compute Node. If false, the Compute Node is a Spot/Low-priority Compute Node.

lastBootTime

string

The last time at which the Compute Node was started.
This property may not be present if the Compute Node state is unusable.

nodeAgentInfo

NodeAgentInformation

Information about the Compute Node agent version and the time the Compute Node upgraded to a new version.
The Batch Compute Node agent is a program that runs on each Compute Node in the Pool and provides Batch capability on the Compute Node.

recentTasks

TaskInformation[]

A list of Tasks whose state has recently changed.
This property is present only if at least one Task has run on this Compute Node since it was assigned to the Pool.

runningTaskSlotsCount

integer

The total number of scheduling slots used by currently running Job Tasks on the Compute Node. This includes Job Manager Tasks and normal Tasks, but not Job Preparation, Job Release or Start Tasks.

runningTasksCount

integer

The total number of currently running Job Tasks on the Compute Node. This includes Job Manager Tasks and normal Tasks, but not Job Preparation, Job Release or Start Tasks.

schedulingState

SchedulingState

Whether the Compute Node is available for Task scheduling.

startTask

StartTask

The Task specified to run on the Compute Node as it joins the Pool.
Batch will retry Tasks when a recovery operation is triggered on a Node. Examples of recovery operations include (but are not limited to) when an unhealthy Node is rebooted or a Compute Node disappeared due to host failure. Retries due to recovery operations are independent of and are not counted against the maxTaskRetryCount. Even if the maxTaskRetryCount is 0, an internal retry due to a recovery operation may occur. Because of this, all Tasks should be idempotent. This means Tasks need to tolerate being interrupted and restarted without causing any corruption or duplicate data. The best practice for long running Tasks is to use some form of checkpointing. In some cases the StartTask may be re-run even though the Compute Node was not rebooted. Special care should be taken to avoid StartTasks which create breakaway process or install/launch services from the StartTask working directory, as this will block Batch from being able to re-run the StartTask.

startTaskInfo

StartTaskInformation

Runtime information about the execution of the StartTask on the Compute Node.

state

ComputeNodeState

The current state of the Compute Node.
The Spot/Low-priority Compute Node has been preempted. Tasks which were running on the Compute Node when it was preempted will be rescheduled when another Compute Node becomes available.

stateTransitionTime

string

The time at which the Compute Node entered its current state.

totalTasksRun

integer

The total number of Job Tasks completed on the Compute Node. This includes Job Manager Tasks and normal Tasks, but not Job Preparation, Job Release or Start Tasks.

totalTasksSucceeded

integer

The total number of Job Tasks which completed successfully (with exitCode 0) on the Compute Node. This includes Job Manager Tasks and normal Tasks, but not Job Preparation, Job Release or Start Tasks.

url

string

The URL of the Compute Node.

virtualMachineInfo

VirtualMachineInfo

Info about the current state of the virtual machine.

vmSize

string

The size of the virtual machine hosting the Compute Node.
For information about available sizes of virtual machines in Pools, see Choose a VM size for Compute Nodes in an Azure Batch Pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes).

ComputeNodeEndpointConfiguration

The endpoint configuration for the Compute Node.

Name Type Description
inboundEndpoints

InboundEndpoint[]

The list of inbound endpoints that are accessible on the Compute Node.

ComputeNodeError

An error encountered by a Compute Node.

Name Type Description
code

string

An identifier for the Compute Node error. Codes are invariant and are intended to be consumed programmatically.

errorDetails

NameValuePair[]

The list of additional error details related to the Compute Node error.

message

string

A message describing the Compute Node error, intended to be suitable for display in a user interface.

ComputeNodeIdentityReference

The reference to a user assigned identity associated with the Batch pool which a compute node will use.

Name Type Description
resourceId

string

The ARM resource id of the user assigned identity.

ComputeNodeListResult

The result of listing the Compute Nodes in a Pool.

Name Type Description
odata.nextLink

string

The URL to get the next set of results.

value

ComputeNode[]

The list of Compute Nodes.

ComputeNodeState

The current state of the Compute Node.

Name Type Description
creating

string

The Batch service has obtained the underlying virtual machine from Azure Compute, but it has not yet started to join the Pool.

idle

string

The Compute Node is not currently running a Task.

leavingpool

string

The Compute Node is leaving the Pool, either because the user explicitly removed it or because the Pool is resizing or autoscaling down.

offline

string

The Compute Node is not currently running a Task, and scheduling of new Tasks to the Compute Node is disabled.

preempted

string

The Spot/Low-priority Compute Node has been preempted. Tasks which were running on the Compute Node when it was preempted will be rescheduled when another Compute Node becomes available.

rebooting

string

The Compute Node is rebooting.

reimaging

string

The Compute Node is reimaging.

running

string

The Compute Node is running one or more Tasks (other than a StartTask).

starting

string

The Batch service is starting on the underlying virtual machine.

starttaskfailed

string

The StartTask has failed on the Compute Node (and exhausted all retries), and waitForSuccess is set. The Compute Node is not usable for running Tasks.

unknown

string

The Batch service has lost contact with the Compute Node, and does not know its true state.

unusable

string

The Compute Node cannot be used for Task execution due to errors.

waitingforstarttask

string

The StartTask has started running on the Compute Node, but waitForSuccess is set and the StartTask has not yet completed.

ContainerRegistry

A private container registry.

Name Type Description
identityReference

ComputeNodeIdentityReference

The reference to the user assigned identity to use to access an Azure Container Registry instead of username and password.
The reference to a user assigned identity associated with the Batch pool which a compute node will use.

password

string

The password to log into the registry server.

registryServer

string

The registry URL.
If omitted, the default is "docker.io".

username

string

The user name to log into the registry server.

ContainerWorkingDirectory

The location of the container Task working directory.

Name Type Description
containerImageDefault

string

Use the working directory defined in the container Image. Beware that this directory will not contain the Resource Files downloaded by Batch.

taskWorkingDirectory

string

Use the standard Batch service Task working directory, which will contain the Task Resource Files populated by Batch.

ElevationLevel

The elevation level of the user.

Name Type Description
admin

string

The user is a user with elevated access and operates with full Administrator permissions.

nonadmin

string

The user is a standard user without elevated access.

EnvironmentSetting

An environment variable to be set on a Task process.

Name Type Description
name

string

The name of the environment variable.

value

string

The value of the environment variable.

ErrorCategory

The category of the error.

Name Type Description
servererror

string

The error is due to an internal server issue.

usererror

string

The error is due to a user issue, such as misconfiguration.

ErrorMessage

An error message received in an Azure Batch error response.

Name Type Description
lang

string

The language code of the error message

value

string

The text of the message.

ImageReference

A reference to an Azure Virtual Machines Marketplace Image or a Azure Compute Gallery Image. To get the list of all Azure Marketplace Image references verified by Azure Batch, see the 'List Supported Images' operation.

Name Type Description
exactVersion

string

The specific version of the platform image or marketplace image used to create the node. This read-only field differs from 'version' only if the value specified for 'version' when the pool was created was 'latest'.

offer

string

The offer type of the Azure Virtual Machines Marketplace Image.
For example, UbuntuServer or WindowsServer.

publisher

string

The publisher of the Azure Virtual Machines Marketplace Image.
For example, Canonical or MicrosoftWindowsServer.

sku

string

The SKU of the Azure Virtual Machines Marketplace Image.
For example, 18.04-LTS or 2019-Datacenter.

version

string

The version of the Azure Virtual Machines Marketplace Image.
A value of 'latest' can be specified to select the latest version of an Image. If omitted, the default is 'latest'.

virtualMachineImageId

string

The ARM resource identifier of the Azure Compute Gallery Image. Compute Nodes in the Pool will be created using this Image Id. This is of the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{VersionId} or /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName} for always defaulting to the latest image version.
This property is mutually exclusive with other ImageReference properties. The Azure Compute Gallery Image must have replicas in the same region and must be in the same subscription as the Azure Batch account. If the image version is not specified in the imageId, the latest version will be used. For information about the firewall settings for the Batch Compute Node agent to communicate with the Batch service see https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration.

InboundEndpoint

An inbound endpoint on a Compute Node.

Name Type Description
backendPort

integer

The backend port number of the endpoint.

frontendPort

integer

The public port number of the endpoint.

name

string

The name of the endpoint.

protocol

InboundEndpointProtocol

The protocol of the endpoint.

publicFQDN

string

The public fully qualified domain name for the Compute Node.

publicIPAddress

string

The public IP address of the Compute Node.

InboundEndpointProtocol

The protocol of the endpoint.

Name Type Description
tcp

string

Use TCP for the endpoint.

udp

string

Use UDP for the endpoint.

NameValuePair

Represents a name-value pair.

Name Type Description
name

string

The name in the name-value pair.

value

string

The value in the name-value pair.

NodeAgentInformation

Information about the Compute Node agent.

Name Type Description
lastUpdateTime

string

The time when the Compute Node agent was updated on the Compute Node.
This is the most recent time that the Compute Node agent was updated to a new version.

version

string

The version of the Batch Compute Node agent running on the Compute Node.
This version number can be checked against the Compute Node agent release notes located at https://github.com/Azure/Batch/blob/master/changelogs/nodeagent/CHANGELOG.md.

ResourceFile

A single file or multiple files to be downloaded to a Compute Node.

Name Type Description
autoStorageContainerName

string

The storage container name in the auto storage Account.
The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified.

blobPrefix

string

The blob prefix to use when downloading blobs from an Azure Storage container. Only the blobs whose names begin with the specified prefix will be downloaded.
The property is valid only when autoStorageContainerName or storageContainerUrl is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded.

fileMode

string

The file permission mode attribute in octal format.
This property applies only to files being downloaded to Linux Compute Nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows Compute Node. If this property is not specified for a Linux Compute Node, then a default value of 0770 is applied to the file.

filePath

string

The location on the Compute Node to which to download the file(s), relative to the Task's working directory.
If the httpUrl property is specified, the filePath is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In the case where filePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the Task's working directory (for example by using '..').

httpUrl

string

The URL of the file to download.
The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. If the URL points to Azure Blob Storage, it must be readable from compute nodes. There are three ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, use a managed identity with read permission, or set the ACL for the blob or its container to allow public access.

identityReference

ComputeNodeIdentityReference

The reference to the user assigned identity to use to access Azure Blob Storage specified by storageContainerUrl or httpUrl
The reference to a user assigned identity associated with the Batch pool which a compute node will use.

storageContainerUrl

string

The URL of the blob container within Azure Blob Storage.
The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. This URL must be readable and listable from compute nodes. There are three ways to get such a URL for a container in Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on the container, use a managed identity with read and list permissions, or set the ACL for the container to allow public access.

SchedulingState

Whether the Compute Node is available for Task scheduling.

Name Type Description
disabled

string

No new Tasks will be scheduled on the Compute Node. Tasks already running on the Compute Node may still run to completion. All Compute Nodes start with scheduling enabled.

enabled

string

Tasks can be scheduled on the Compute Node.

StartTask

A Task which is run when a Node joins a Pool in the Azure Batch service, or when the Compute Node is rebooted or reimaged.

Name Type Description
commandLine

string

The command line of the StartTask.
The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the Task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables).

containerSettings

TaskContainerSettings

The settings for the container under which the StartTask runs.
When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all Task environment variables are mapped into the container, and the Task command line is executed in the container. Files produced in the container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file APIs will not be able to access those files.

environmentSettings

EnvironmentSetting[]

A list of environment variable settings for the StartTask.

maxTaskRetryCount

integer

The maximum number of times the Task may be retried.
The Batch service retries a Task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the Task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the Task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the Task. If the maximum retry count is -1, the Batch service retries the Task without limit, however this is not recommended for a start task or any task. The default value is 0 (no retries).

resourceFiles

ResourceFile[]

A list of files that the Batch service will download to the Compute Node before running the command line. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers.
Files listed under this element are located in the Task's working directory.

userIdentity

UserIdentity

The user identity under which the StartTask runs.
If omitted, the Task runs as a non-administrative user unique to the Task.

waitForSuccess

boolean

Whether the Batch service should wait for the StartTask to complete successfully (that is, to exit with exit code 0) before scheduling any Tasks on the Compute Node.
If true and the StartTask fails on a Node, the Batch service retries the StartTask up to its maximum retry count (maxTaskRetryCount). If the Task has still not completed successfully after all retries, then the Batch service marks the Node unusable, and will not schedule Tasks to it. This condition can be detected via the Compute Node state and failure info details. If false, the Batch service will not wait for the StartTask to complete. In this case, other Tasks can start executing on the Compute Node while the StartTask is still running; and even if the StartTask fails, new Tasks will continue to be scheduled on the Compute Node. The default is true.

StartTaskInformation

Information about a StartTask running on a Compute Node.

Name Type Description
containerInfo

TaskContainerExecutionInformation

Information about the container under which the Task is executing.
This property is set only if the Task runs in a container context.

endTime

string

The time at which the StartTask stopped running.
This is the end time of the most recent run of the StartTask, if that run has completed (even if that run failed and a retry is pending). This element is not present if the StartTask is currently running.

exitCode

integer

The exit code of the program specified on the StartTask command line.
This property is set only if the StartTask is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the StartTask (due to timeout, or user termination via the API) you may see an operating system-defined exit code.

failureInfo

TaskFailureInformation

Information describing the Task failure, if any.
This property is set only if the Task is in the completed state and encountered a failure.

lastRetryTime

string

The most recent time at which a retry of the Task started running.
This element is present only if the Task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the Task has been restarted for reasons other than retry; for example, if the Compute Node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not.

result

TaskExecutionResult

The result of the Task execution.
If the value is 'failed', then the details of the failure can be found in the failureInfo property.

retryCount

integer

The number of times the Task has been retried by the Batch service.
Task application failures (non-zero exit code) are retried, pre-processing errors (the Task could not be run) and file upload errors are not retried. The Batch service will retry the Task up to the limit specified by the constraints.

startTime

string

The time at which the StartTask started running.
This value is reset every time the Task is restarted or retried (that is, this is the most recent time at which the StartTask started running).

state

StartTaskState

The state of the StartTask on the Compute Node.

StartTaskState

The state of the StartTask on the Compute Node.

Name Type Description
completed

string

The StartTask has exited with exit code 0, or the StartTask has failed and the retry limit has reached, or the StartTask process did not run due to Task preparation errors (such as resource file download failures).

running

string

The StartTask is currently running.

TaskContainerExecutionInformation

Contains information about the container which a Task is executing.

Name Type Description
containerId

string

The ID of the container.

error

string

Detailed error information about the container.
This is the detailed error string from the Docker service, if available. It is equivalent to the error field returned by "docker inspect".

state

string

The state of the container.
This is the state of the container according to the Docker service. It is equivalent to the status field returned by "docker inspect".

TaskContainerSettings

The container settings for a Task.

Name Type Description
containerRunOptions

string

Additional options to the container create command.
These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service.

imageName

string

The Image to use to create the container in which the Task will run.
This is the full Image reference, as would be specified to "docker pull". If no tag is provided as part of the Image name, the tag ":latest" is used as a default.

registry

ContainerRegistry

The private registry which contains the container Image.
This setting can be omitted if was already provided at Pool creation.

workingDirectory

ContainerWorkingDirectory

The location of the container Task working directory.
The default is 'taskWorkingDirectory'.

TaskExecutionInformation

Information about the execution of a Task.

Name Type Description
containerInfo

TaskContainerExecutionInformation

Information about the container under which the Task is executing.
This property is set only if the Task runs in a container context.

endTime

string

The time at which the Task completed.
This property is set only if the Task is in the Completed state.

exitCode

integer

The exit code of the program specified on the Task command line.
This property is set only if the Task is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the Task (due to timeout, or user termination via the API) you may see an operating system-defined exit code.

failureInfo

TaskFailureInformation

Information describing the Task failure, if any.
This property is set only if the Task is in the completed state and encountered a failure.

lastRequeueTime

string

The most recent time at which the Task has been requeued by the Batch service as the result of a user request.
This property is set only if the requeueCount is nonzero.

lastRetryTime

string

The most recent time at which a retry of the Task started running.
This element is present only if the Task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the Task has been restarted for reasons other than retry; for example, if the Compute Node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not.

requeueCount

integer

The number of times the Task has been requeued by the Batch service as the result of a user request.
When the user removes Compute Nodes from a Pool (by resizing/shrinking the pool) or when the Job is being disabled, the user can specify that running Tasks on the Compute Nodes be requeued for execution. This count tracks how many times the Task has been requeued for these reasons.

result

TaskExecutionResult

The result of the Task execution.
If the value is 'failed', then the details of the failure can be found in the failureInfo property.

retryCount

integer

The number of times the Task has been retried by the Batch service.
Task application failures (non-zero exit code) are retried, pre-processing errors (the Task could not be run) and file upload errors are not retried. The Batch service will retry the Task up to the limit specified by the constraints.

startTime

string

The time at which the Task started running.
'Running' corresponds to the running state, so if the Task specifies resource files or Packages, then the start time reflects the time at which the Task started downloading or deploying these. If the Task has been restarted or retried, this is the most recent time at which the Task started running. This property is present only for Tasks that are in the running or completed state.

TaskExecutionResult

The result of Task execution.

Name Type Description
failure

string

There was an error during processing of the Task. The failure may have occurred before the Task process was launched, while the Task process was executing, or after the Task process exited.

success

string

The Task ran successfully.

TaskFailureInformation

Information about a Task failure.

Name Type Description
category

ErrorCategory

The category of the Task error.

code

string

An identifier for the Task error. Codes are invariant and are intended to be consumed programmatically.

details

NameValuePair[]

A list of additional details related to the error.

message

string

A message describing the Task error, intended to be suitable for display in a user interface.

TaskInformation

Information about a Task running on a Compute Node.

Name Type Description
executionInfo

TaskExecutionInformation

Information about the execution of the Task.

jobId

string

The ID of the Job to which the Task belongs.

subtaskId

integer

The ID of the subtask if the Task is a multi-instance Task.

taskId

string

The ID of the Task.

taskState

TaskState

The current state of the Task.

taskUrl

string

The URL of the Task.

TaskState

The state of the Task.

Name Type Description
active

string

The Task is queued and able to run, but is not currently assigned to a Compute Node. A Task enters this state when it is created, when it is enabled after being disabled, or when it is awaiting a retry after a failed run.

completed

string

The Task is no longer eligible to run, usually because the Task has finished successfully, or the Task has finished unsuccessfully and has exhausted its retry limit. A Task is also marked as completed if an error occurred launching the Task, or when the Task has been terminated.

preparing

string

The Task has been assigned to a Compute Node, but is waiting for a required Job Preparation Task to complete on the Compute Node. If the Job Preparation Task succeeds, the Task will move to running. If the Job Preparation Task fails, the Task will return to active and will be eligible to be assigned to a different Compute Node.

running

string

The Task is running on a Compute Node. This includes task-level preparation such as downloading resource files or deploying Packages specified on the Task - it does not necessarily mean that the Task command line has started executing.

UserIdentity

The definition of the user identity under which the Task is run.

Name Type Description
autoUser

AutoUserSpecification

The auto user under which the Task is run.
The userName and autoUser properties are mutually exclusive; you must specify one but not both.

username

string

The name of the user identity under which the Task is run.
The userName and autoUser properties are mutually exclusive; you must specify one but not both.

VirtualMachineInfo

Info about the current state of the virtual machine.

Name Type Description
imageReference

ImageReference

The reference to the Azure Virtual Machine's Marketplace Image.

scaleSetVmResourceId

string

The resource ID of the Compute Node's current Virtual Machine Scale Set VM. Only defined if the Batch Account was created with its poolAllocationMode property set to 'UserSubscription'.