Delete and recover packages

Azure DevOps Services | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018 | TFS 2017

Azure Artifacts keeps all of your artifacts safe for as long as you need them, whether you published them directly or saved them from upstream sources. But, as older artifacts fall out of use, you may want to clean them up or let Azure Artifacts remove them automatically. In this article, you’ll learn how to:

  1. Delete packages from Azure Artifacts feeds.
  2. Set up retention policies to automatically delete older, unwanted packages from feeds.
  3. Recover recently deleted packages from the recycle bin.

Note

To delete, recover packages and set up retention policies, you need to be an Owner of that particular feed.

Delete packages from Azure Artifacts feeds

Choose the artifact from the Packages page in the Build and Release page group and select the appropriate option from the menu:

Delete Maven artifact Azure DevOps Services

When you publish a particular version of a package to a feed, that version number is permanently reserved. You cannot upload a newer revision package with that same version number, or delete it and upload a new package at the same version.

Note

Packages that are placed in the recycle bin will be deleted permanently after 30 days. However, these packages still count as part of your storage bill. If you want to delete them sooner, you can navigate to the recycle bin and delete them manually.

Automatically delete old package versions with retention policies

Over time, the number of versions for each package being hosted in your feed can grow quickly. You can set up retention policies to automatically delete old packages and save storage space.

  • maximum number of versions: allow you to chose how many versions of a package you want to keep.
  • days to keep recently downloaded packages. Packages will be deleted only if they have not been downloaded for the number of days set in here.

If you'd like to retain a package indefinitely, you can promote it to a view. Versions that got promoted to views are exempt from retention policies and will not be deleted.

Note

Package demotion is not currently supported. If you want this feature to be added to future releases, please feel free to Suggest a feature on our Azure DevOps Developer Community. See Get started with feed views for more information.

To configure retention policies:

  1. Navigate to Azure Artifacts.

    Go to Azure Artifacts

  2. Select the gear icon in your feed and select Feed settings.

    Top right of screen, gear icon and then feed settings

  3. From the Feed details tab, in the Retention policies setting, enter the maximum number of versions per package to retain, and the number of days to keep recently downloaded packages.

    Edit retention policy settings for old packages in Azure DevOps Services or TFS

  4. Select Save.

  1. Select Build and Release, then Packages to navigate to your feed and select the gear icon.

    Edit an Azure DevOps Services feed in Package

  2. From the Retention tab, enter the maximum number of versions per package to retain.

    Edit retention policy settings for old packages in Azure DevOps Services or TFS

  3. Select Save.

Note

When you enable retention policies, a version of a package will be deleted when both of the following criteria are met:

  1. The number of published versions of that package reaches the maximum number of versions limit, AND
  2. A version of that package has not been downloaded within the number of days to keep recently downloaded packages.

Recover a deleted package from the recycle bin

Deleted packages will remain in the recycle bin for 30 days after which it will be permanently deleted. You must be assigned an owner role in order for you to recover deleted packages.

  1. Select Azure Artifacts.

    Go to Azure Artifacts

  2. Select "Recycle Bin".

  3. Select the appropriate package then select the package version.

  4. Select Restore to feed.

  1. Select Build and Release, then Packages to navigate to your feed and select Recycle bin.

    Recycle Bin TFS

  2. Select the appropriate package then select the package version.

    Recycle Bin package view TFS

  3. Select Restore to feed.

    Restore package TFS

Q&A

Q: What happens with old/existing packages when we enable retention policies?

A: Those packages will get soft-deleted and moved to the recycle bin. The deletion job runs once a day but there could be an initial delay after the policy is turned on for the first time due to an influx of packages. Packages remain in the recycle bin for 30 days before they are permanently deleted. To remove the packages from your billable storage, you can chose to delete them manually using the UI or the REST API before the 30 days is up.

What's next?