Delen via


Clean up old data in Azure DevOps Server

Azure DevOps Server 2022 | Azure DevOps Server 2020 | Azure DevOps Server 2019

Over time, Azure DevOps Server instances can build up very large volumes of data, including files, builds, work items, and so forth. During the lifetime of a project, this data is valuable as a history of the various artifacts involved in producing software. Eventually the costs involved in maintaining older data - which include performance impacts and increased time spent on upgrades, in addition to the increased disk space requirements - may exceed the benefits.

This article provides guidance for cleaning up a variety of different types of data, primarily from Azure DevOps Server collection databases.

Note that the size of any SQL data files will not decrease after cleanup, since SQL Server will reserve the space for future use.

Important

In all of the following cases, once the data has been cleaned up it cannot be recovered except by restoring a database backup. Be careful to only clean up data that you are sure you no longer need.

Prequisite

To perform these procedures, you need to be a highly permissioned user, typically a member of a Project Collection or Project Administrators group.

Projects

If you have entire projects that are no longer needed, deleting them may have a large impact, since this will remove all content for the project across all feature areas. There are two ways to delete a project:

  1. Using the web portal.

  2. Using the TfsDeleteProject tool that is included with Visual Studio installations.

The two methods will by default perform the same set of actions.

Files

Typically, file contents consume the majority of the space in Azure DevOps Server collection databases, so cleaning up unneeded files can have a significant impact on data volume. There are many different types of files stored in Azure DevOps Server collection databases, including Team Foundation Version Control files, Git files, work item attachments, test case attachments, build outputs, and so on. Most but not all of them support cleanup.

Note that file contents are not generally cleaned up immediately upon deletion, but rather by a background job that runs on a periodic basis (typically once per day).

Team Foundation Version Control content

When Team Foundation Version Control (TFVC) branches, folders, and files are deleted, they are only logically deleted - their content is still available in history. TFVC branches, folders, or individual files can be physically deleted using the destroy command in tf.exe.

Test attachments

Test attachments created during test runs can be cleaned up using the Test Attachment Cleaner, which is included with the Azure DevOps Server Power Tools.

Another option for cleaning up test data is to set the test retention policy for a project. To learn more, see Control how long to keep test results.

XAML Builds

When builds in Azure DevOps Server are deleted, a subset of the information they produced is preserved to avoid losing reporting data the next time the warehouse is rebuilt. Build data can be physically deleted using the destroy command in tfsbuild.exe.

In addition, you can set retention policies for your build and release pipelines. To learn more, see Build and release retention policies.