Pool - Patch

Updates the properties of the specified Pool.
This only replaces the Pool properties specified in the request. For example, if the Pool has a StartTask associated with it, and a request does not specify a StartTask element, then the Pool keeps the existing StartTask.

PATCH {batchUrl}/pools/{poolId}?api-version=2019-08-01.10.0
PATCH {batchUrl}/pools/{poolId}?timeout={timeout}&api-version=2019-08-01.10.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 to update.

timeout
query
  • integer
int32

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

api-version
query True
  • string

Client API Version.

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.

If-Match
  • string

An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client.

If-None-Match
  • string

An ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client.

If-Modified-Since
  • string
date-time-rfc1123

A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time.

If-Unmodified-Since
  • string
date-time-rfc1123

A timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time.

Request Body

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

Name Type Description
applicationPackageReferences

A list of Packages to be installed on each Compute Node in the Pool.
Changes to Package references affect all new Nodes joining the Pool, but do not affect Compute Nodes that are already in the Pool until they are rebooted or reimaged. If this element is present, it replaces any existing Package references. If you specify an empty collection, then all Package references are removed from the Pool. If omitted, any existing Package references are left unchanged.

certificateReferences

A list of Certificates to be installed on each Compute Node in the Pool.
If this element is present, it replaces any existing Certificate references configured on the Pool. If omitted, any existing Certificate references are left unchanged. 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.

metadata

A list of name-value pairs associated with the Pool as metadata.
If this element is present, it replaces any existing metadata configured on the Pool. If you specify an empty collection, any metadata is removed from the Pool. If omitted, any existing metadata is left unchanged.

startTask

A Task to run on each Compute Node as it joins the Pool. The Task runs when the Compute Node is added to the Pool or when the Compute Node is restarted.
If this element is present, it overwrites any existing StartTask. If omitted, any existing StartTask is left unchanged.

Responses

Name Type Description
200 OK

The request to the Batch service was successful.

Headers

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

The error from the Batch service.

Security

azure_auth

Azure Active Directory OAuth2 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

Patch the Pool

Sample Request

PATCH account.region.batch.azure.com/pools/poolId?api-version=2019-08-01.10.0
client-request-id: 00000000-0000-0000-0000-000000000000
ocp-date: Fri, 17 Feb 2017 00:00:00 GMT
{
  "startTask": {
    "commandLine": "/bin/bash -c 'echo start task'"
  }
}

Sample Response

Definitions

ApplicationPackageReference

A reference to an Package to be deployed to Compute Nodes.

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.

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.

ErrorMessage

An error message received in an Azure Batch error response.

MetadataItem

A name-value pair associated with a Batch service resource.

PoolPatchParameter

The set of changes to be made to a Pool.

ResourceFile

A single file or multiple files to be downloaded to a 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.

TaskContainerSettings

The container settings for a Task.

UserIdentity

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

ApplicationPackageReference

A reference to an Package to be deployed to Compute Nodes.

Name Type Description
applicationId
  • string

The ID of the application to deploy.

version
  • string

The version of the application to deploy. If omitted, the default version is deployed.
If this is omitted on a Pool, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences and HTTP status code 409. If this is omitted on a Task, and no default version is specified for this application, the Task fails with a pre-processing error.

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

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

scope

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

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

values

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

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
  • string[]

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.

ContainerRegistry

A private container registry.

Name Type Description
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.

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.

MetadataItem

A name-value pair associated with a Batch service resource.

Name Type Description
name
  • string

The name of the metadata item.

value
  • string

The value of the metadata item.

PoolPatchParameter

The set of changes to be made to a Pool.

Name Type Description
applicationPackageReferences

A list of Packages to be installed on each Compute Node in the Pool.
Changes to Package references affect all new Nodes joining the Pool, but do not affect Compute Nodes that are already in the Pool until they are rebooted or reimaged. If this element is present, it replaces any existing Package references. If you specify an empty collection, then all Package references are removed from the Pool. If omitted, any existing Package references are left unchanged.

certificateReferences

A list of Certificates to be installed on each Compute Node in the Pool.
If this element is present, it replaces any existing Certificate references configured on the Pool. If omitted, any existing Certificate references are left unchanged. 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.

metadata

A list of name-value pairs associated with the Pool as metadata.
If this element is present, it replaces any existing metadata configured on the Pool. If you specify an empty collection, any metadata is removed from the Pool. If omitted, any existing metadata is left unchanged.

startTask

A Task to run on each Compute Node as it joins the Pool. The Task runs when the Compute Node is added to the Pool or when the Compute Node is restarted.
If this element is present, it overwrites any existing StartTask. If omitted, any existing StartTask is left unchanged.

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 using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for the blob or its container to allow public access.

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 using anonymous access; that is, the Batch service does not present any credentials when downloading blobs from the container. There are two 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, or set the ACL for the container to allow public access.

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

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

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.

resourceFiles

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

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.

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

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

workingDirectory

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

UserIdentity

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

Name Type Description
autoUser

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.