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:
- Delete packages from Azure Artifacts feeds.
- Set up retention policies to automatically delete older, unwanted packages from feeds.
- 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:
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:
Navigate to Azure Artifacts.
Select the gear icon in your feed and select Feed settings.
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.
Select Save.
Select Build and Release, then Packages to navigate to your feed and select the gear icon.
From the Retention tab, enter the maximum number of versions per package to retain.
Select Save.
Note
When you enable retention policies, a version of a package will be deleted when both of the following criteria are met:
- The number of published versions of that package reaches the maximum number of versions limit, AND
- 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.
Select Azure Artifacts.
Select "Recycle Bin".
Select the appropriate package then select the package version.
Select Restore to feed.
Select Build and Release, then Packages to navigate to your feed and select Recycle bin.
Select the appropriate package then select the package version.
Select Restore to feed.
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.