Bulk delete all the old jobs from the batch account by info.odysseyx@gmail.com August 22, 2024 written by info.odysseyx@gmail.com August 22, 2024 0 comment 22 views 22 When you delete a job, all jobs and all job statistics belonging to that job are also deleted. It also ignores the retention period of job data. That is, if a job still contains jobs that are retained on compute nodes, the batch service deletes the job’s job directory and all its contents. When a request to delete a job is received, the batch service sets the job to the deleted state. Any update operations on a job in the deleted state fail with status code 409 (Conflict) and additional information indicating that the job is being deleted. The PowerShell command below allows you to delete a single task using its task ID. Remove-AzBatchJob -Id "Job-000001" -BatchContext $Context However, if you have a large number of tasks and want to delete them all at once, refer to the PowerShell command below. # Replace with your Azure Batch account name, resource group, and subscription ID $accountName = "yourBatchAccountName" $resourceGroupName = "yourResourceGroupName" # Authenticate to Azure Connect-AzAccount # Get the Batch account context $batchContext = Get-AzBatchAccount -Name $accountName -ResourceGroupName $resourceGroupName # Get all batch jobs with creation time before May 2024 # Replace the creation time date accordingly $jobsForDelete = Get-AzBatchJob -BatchContext $batchContext | Where-Object {$_.CreationTime -lt "2024-05-01"} # List the jobs Write-Host "Jobs to be deleted:" foreach ($job in $jobsForDelete) { Write-Host $job.Id # Write-Host "Deleting jobs..." Remove-AzBatchJob -Id $job.Id -BatchContext $batchContext -Force } The above script will delete all jobs created before the creation date. You can modify the parameters as per your needs. Source link Share 0 FacebookTwitterPinterestEmail info.odysseyx@gmail.com previous post Just a moment… next post Just a moment… You may also like Apple adds a computer protocol from the brain to its accessibility Reptowar May 14, 2025 AI Brand Management Rules Writing again May 13, 2025 AI and Algorithmic Music: Next Law of Entertainment May 12, 2025 Matter and Infinian Smart Home Protection Defines the standard May 9, 2025 The Weemo Robotaxi builds the Arizona factory to extend the fleet May 7, 2025 Chatbots are having minimal impact on search engine traffic: study May 6, 2025 Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment.