Compartilhar via


Pool - Update Properties

Updates the properties of the specified Pool.
This fully replaces all the updatable properties of the Pool. For example, if the Pool has a StartTask associated with it and if StartTask is not specified with this request, then the Batch service will remove the existing StartTask.

POST {batchUrl}/pools/{poolId}/updateproperties?api-version=2024-07-01.20.0
POST {batchUrl}/pools/{poolId}/updateproperties?timeout={timeout}&api-version=2024-07-01.20.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.

api-version
query True

string

Client API Version.

timeout
query

integer

int32

The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.

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.

Request Body

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

Name Required Type Description
applicationPackageReferences True

ApplicationPackageReference[]

The list of Application Packages to be installed on each Compute Node in the Pool.
The list replaces any existing Application Package references on the Pool. Changes to Application Package references affect all new Compute Nodes joining the Pool, but do not affect Compute Nodes that are already in the Pool until they are rebooted or reimaged. There is a maximum of 10 Application Package references on any given Pool. If omitted, or if you specify an empty collection, any existing Application Packages references are removed from the Pool. A maximum of 10 references may be specified on a given Pool.

certificateReferences True

CertificateReference[]

A list of Certificates to be installed on each Compute Node in the Pool.
This list replaces any existing Certificate references configured on the Pool. If you specify an empty collection, any existing Certificate references are removed from the Pool. 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.

metadata True

MetadataItem[]

A list of name-value pairs associated with the Pool as metadata.
This list replaces any existing metadata configured on the Pool. If omitted, or if you specify an empty collection, any existing metadata is removed from the Pool.

startTask

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 removed from the Pool.

targetNodeCommunicationMode

NodeCommunicationMode

The desired node communication mode for the pool.
This setting replaces any existing targetNodeCommunication setting on the Pool. If omitted, the existing setting is default.

Responses

Name Type Description
204 No Content

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

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

Pool update

Sample request

POST account.region.batch.azure.com/pools/poolId/updateproperties?api-version=2024-07-01.20.0



{
  "startTask": {
    "commandLine": "/bin/bash -c 'echo start task'"
  },
  "certificateReferences": [],
  "applicationPackageReferences": [],
  "metadata": []
}

Sample response

Definitions

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

CertificateVisibility

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

ComputeNodeIdentityReference

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

ContainerHostBatchBindMountEntry

The entry of path and mount mode you want to mount into task container.

ContainerHostDataPath

The paths which will be mounted to container task's container.

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.

NodeCommunicationMode

Determines how a pool communicates with the Batch service.

PoolUpdatePropertiesParameter

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.
When creating a pool, the package's application ID must be fully qualified (/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}).

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

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. 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. 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.

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.

ContainerHostBatchBindMountEntry

The entry of path and mount mode you want to mount into task container.

Name Type Description
isReadOnly

boolean

Mount this source path as read-only mode or not. Default value is false (read/write mode).
For Linux, if you mount this path as a read/write mode, this does not mean that all users in container have the read/write access for the path, it depends on the access in host VM. If this path is mounted read-only, all users within the container will not be able to modify the path.

source

ContainerHostDataPath

The path which be mounted to container customer can select.

ContainerHostDataPath

The paths which will be mounted to container task's container.

Name Type Description
Applications

string

The applications path.

JobPrep

string

The job-prep task path.

Shared

string

The path for multi-instances task to shared their files.

Startup

string

The path for start task.

Task

string

The task path.

VfsMounts

string

The path contains all virtual file systems are mounted on this node.

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.

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.

NodeCommunicationMode

Determines how a pool communicates with the Batch service.

Name Type Description
classic

string

Nodes using the classic communication mode require inbound TCP communication on ports 29876 and 29877 from the "BatchNodeManagement.{region}" service tag and outbound TCP communication on port 443 to the "Storage.region" and "BatchNodeManagement.{region}" service tags.

default

string

The node communication mode is automatically set by the Batch service.

simplified

string

Nodes using the simplified communication mode require outbound TCP communication on port 443 to the "BatchNodeManagement.{region}" service tag. No open inbound ports are required.

PoolUpdatePropertiesParameter

The set of changes to be made to a Pool.

Name Type Description
applicationPackageReferences

ApplicationPackageReference[]

The list of Application Packages to be installed on each Compute Node in the Pool.
The list replaces any existing Application Package references on the Pool. Changes to Application Package references affect all new Compute Nodes joining the Pool, but do not affect Compute Nodes that are already in the Pool until they are rebooted or reimaged. There is a maximum of 10 Application Package references on any given Pool. If omitted, or if you specify an empty collection, any existing Application Packages references are removed from the Pool. A maximum of 10 references may be specified on a given Pool.

certificateReferences

CertificateReference[]

A list of Certificates to be installed on each Compute Node in the Pool.
This list replaces any existing Certificate references configured on the Pool. If you specify an empty collection, any existing Certificate references are removed from the Pool. 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.

metadata

MetadataItem[]

A list of name-value pairs associated with the Pool as metadata.
This list replaces any existing metadata configured on the Pool. If omitted, or if you specify an empty collection, any existing metadata is removed from the Pool.

startTask

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 removed from the Pool.

targetNodeCommunicationMode

NodeCommunicationMode

The desired node communication mode for the pool.
This setting replaces any existing targetNodeCommunication setting on the Pool. If omitted, the existing setting is default.

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.

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/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.

TaskContainerSettings

The container settings for a Task.

Name Type Description
containerHostBatchBindMounts

ContainerHostBatchBindMountEntry[]

The paths you want to mounted to container task.
If this array is null or be not present, container task will mount entire temporary disk drive in windows (or AZ_BATCH_NODE_ROOT_DIR in Linux). It won't' mount any data paths into container if this array is set as empty.

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'.

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.