Delete packages and recover deleted packages from the recycle bin in Azure Artifacts

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 clean them up automatically. In this article, you’ll learn how to:

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

Delete packages from Azure Artifacts feeds

You must be an owner to delete an artifact.

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

Deleting packages respects feed immutability. Once 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.

Automatically delete old package versions with retention policies

Over time, the number of versions for each package being hosted in Azure Artifacts or Team Foundation Server (TFS) can grow quickly. You can configure retention policies to automatically delete old packages in Azure DevOps Services or TFS to improve client performance and release storage space.

With retention policies, you can set the maximum number of versions to retain per package, once that number is hit the oldest version of the package will be deleted. You can also set the number of days to keep recently downloaded packages. Packages will only be deleted by retention policies if they have not been downloaded within the number of days set.

If you'd like to retain a package version indefinitely, you can promote it to a view. Versions that are promoted to views are exempt from retention policies and do not count towards the maximum number of versions retention policy. Retention policies will not delete any version that has been promoted to a view.

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. Click Save.

  1. Navigate to your feed from the Packages page in the Build and Release page group 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. Click Save.

Recover a deleted package from the recycle bin

If you've deleted/unpublished an npm package, NuGet package, or Maven artifact from Azure Artifacts, builds that depend on that package will start to fail. You won't be able to repush that package to the feed because of immutability. In order to recover the package and have builds start working again, you can recover it from the Recycle Bin.

  1. Navigate to Azure Artifacts:

    Go to Azure Artifacts

  2. Select "Recycle Bin".

    Once in the Recycle Bin, you will see any packages that have been deleted from the current feed in the past 30 days.

  3. Click on a package to get more details such as Version, Deleted date/time, and Scheduled permanent deletion.

  4. Select a version to Restore to feed.

  1. Find the Recycle Bin in the Packages page underneath the Build and Release page group in Azure DevOps Services:

    Azure DevOps Services Recycle Bin

    Once in the Recycle Bin, you will see any packages that have been deleted from the current feed in the past 30 days.

  2. Click a package to get more details such as: Version, Deleted date/time, and Scheduled permanent deletion:

    Azure DevOps Services Recycle Bin package view

  3. Select a version to Restore to feed:

    Restore an Azure DevOps Services package with Recycle Bin