Remove-AzureBatchComputeNode

Removes compute nodes from a pool.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

Remove-AzureBatchComputeNode
      [-PoolId] <String>
      [-Ids] <String[]>
      [-DeallocationOption <ComputeNodeDeallocationOption>]
      [-ResizeTimeout <TimeSpan>]
      [-Force]
      -BatchContext <BatchAccountContext>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureBatchComputeNode
      [[-ComputeNode] <PSComputeNode>]
      [-DeallocationOption <ComputeNodeDeallocationOption>]
      [-ResizeTimeout <TimeSpan>]
      [-Force]
      -BatchContext <BatchAccountContext>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-AzureBatchComputeNode cmdlet removes Azure Batch compute nodes from a pool.

Examples

Example 1: Remove a compute node

PS C:\>Remove-AzureBatchComputeNode -PoolId "Pool07" -Ids "tvm-2316545714_1-20150725t213220z" -DeallocationOption Terminate -ResizeTimeout ([TimeSpan]::FromMinutes(10)) -BatchContext $Context

This command removes compute node that has the specified ID from pool that has the ID Pool07. The command specifies the Terminate deallocation option. The resize time-out is of 10 minutes.

Example 2: Remove a compute node by using the pipeline

PS C:\>Get-AzureBatchComputeNode -PoolId "Pool07" -Id "tvm-2316545714_1-20150725t213220z" -BatchContext $Context | Remove-AzureBatchComputeNode -Force -BatchContext $Context

This command gets the compute node that has the specified ID from pool that has the ID Pool07 by using the Get-AzureBatchComputeNode cmdlet. The command passes that node to the current cmdlet by using the pipeline. The current cmdlet removes the compute node. The command specifies the Force parameter. Therefore, the command does not prompt you for confirmation.

Example 3: Remove multiple nodes

PS C:\>Remove-AzureBatchComputeNode -PoolId "Pool07" @("tvm-1783593343_28-20151117t214257z","tvm-1783593343_29-20151117t214257z") -Force -BatchContext $Context

This command removes two compute nodes from the pool that has the ID Pool07. The command does not prompt you for confirmation.

Parameters

-BatchContext

Specifies the BatchAccountContext instance that this cmdlet uses to interact with the Batch service. If you use the Get-AzureRmBatchAccount cmdlet to get your BatchAccountContext, then Microsoft Entra authentication will be used when interacting with the Batch service. To use shared key authentication instead, use the Get-AzureRmBatchAccountKeys cmdlet to get a BatchAccountContext object with its access keys populated. When using shared key authentication, the primary access key is used by default. To change the key to use, set the BatchAccountContext.KeyInUse property.

Type:BatchAccountContext
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ComputeNode

Specifies the PSComputeNode object that represents the compute node that this cmdlet removes.

Type:PSComputeNode
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DeallocationOption

Specifies a deallocation option for the removal operation that this cmdlet starts. The default value is Requeue.

Type:Nullable<T>[ComputeNodeDeallocationOption]
Accepted values:Requeue, Terminate, TaskCompletion, RetainedData
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Ids

Specifies an array of IDs of compute nodes that this cmdlet removes from the pool.

Type:String[]
Aliases:Id
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PoolId

Specifies the ID of the pool that contains the compute nodes that this cmdlet removes.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResizeTimeout

Specifies the time-out interval for removal of the compute nodes from the pool. The default value is 10 minutes. The minimum value is 5 minutes.

Type:Nullable<T>[TimeSpan]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSComputeNode

Parameters: ComputeNode (ByValue)

BatchAccountContext

Parameters: BatchContext (ByValue)

Outputs

Void