Bulk delete all the old jobs from the batch account
Deleting a Job also deletes all Tasks that are part of that Job, and all Job statistics. This also overrides the retention period for Task data; that is, if the Job contains Tasks which are still retained on Compute Nodes, the Batch service deletes those Tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the Job to the deleting state. All update operations on a Job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the Job is being deleted.
We can use below PowerShell command to delete one single job using job id:
But if you have a large number of jobs and wants to delete them simultaneously, then you can refer below PowerShell command for the same:
The above script will delete all the jobs created before the creation date. You can accordingly modify the parameters as per your requirement.
Published on:
Learn more