Remove-​Azure​Batch​Job

Deletes a Batch job.

Syntax

Remove-AzureBatchJob
      [-Id] <String>
      -BatchContext <BatchAccountContext>
      [-Force]
      [-Confirm]
      [-WhatIf]
      [<CommonParameters>]

Description

The Remove-AzureBatchJob cmdlet deletes an Azure Batch job. This cmdlet prompts you for confirmation before it removes a job, unless you specify the Force parameter.

Examples

Example 1: Delete a Batch job

PS C:\>Remove-AzureBatchJob -Id "Job-000001" -BatchContext $Context

This command deletes the job that has the ID Job-000001. The command prompts you for confirmation before it deletes the job. Use the Get-AzureRmBatchAccountKeys cmdlet to assign a context to the $Context variable.

Example 2: Delete a Batch job without confirmation by using the pipeline

PS C:\>Get-AzureBatchJob -Id "Job-000002" -BatchContext $Context | Remove-AzureBatchJob -Force -BatchContext $Context

This command gets the job that has the ID Job-000002 by using the Get-AzureBatchJob cmdlet. The command passes that job to the current cmdlet by using the pipeline operator. The command deletes that job. Because the command includes the Force parameter, it does not prompt you for confirmation.

Required Parameters

-BatchContext

Specifies the BatchAccountContext instance that this cmdlet uses to interact with the Batch service. To obtain a BatchAccountContext object that contains access keys for your subscription, use the Get-AzureRmBatchAccountKeys cmdlet.

Type:BatchAccountContext
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-Id

Specifies the ID of the job that this cmdlet deletes. You cannot specify wildcard characters.

Type:String
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value: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
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
Accept pipeline input:False
Accept wildcard characters:False