Sdílet prostřednictvím


Delete and recover packages

TFS 2018

Azure Artifacts securely stores various package types within your feed, whether you've published them directly or saved them from upstream sources. As older package versions become less relevant, you may consider removing them through manual deletion or by using retention policies. In this article, you'll learn how to:

  • Delete packages from your feed.
  • Set up retention policies.
  • Manually delete packages permanently.
  • Recover recently deleted packages.

Note

To delete packages or set up retention policies, you must be a feed Owner or Administrator.

Delete packages

In Azure Artifacts, packages are immutable. Once you publish a package to your feed, its version number is reserved permanently. Even if you delete it from your feed, you cannot publish a new package with the same version number.

Note

You must be a Contributor to unlist a package and an Owner to delete it.

There are two available choices for removing a NuGet package from your feed, Unlist and Delete. Unlisting a package version hides it from the search results in Azure Artifacts feeds and on NuGet.org, while deleting a package version sends it to the recycle bin and makes it unavailable for installation.

  1. Navigate to your project http://ServerName:8080/tfs/DefaultCollection/<ProjectName>.

  2. Select Build and Release.

  3. Select Packages, and then select the package you wish to delete.

  4. Select Unlist or Delete latest.

    A screenshot showing how to delete or unlist a NuGet package in Team Foundation Server 2018.

Unlist packages using NuGet.exe

  1. Sign in to your Azure DevOps organization, and then navigate to your project.

  2. Select Artifacts, and then select your feed from the dropdown menu.

  3. Select Connect to feed > NuGet.exe, and then find and copy your Package Source URL. It should resemble this format: "https://pkgs.dev.azure.com/OrganizationName/ProjectName/_packaging/FeedName/nuget/v3/index.json".

  4. Run the following command to unlist your NuGet package:

    nuget.exe delete <PACKAGE_NAME> <PACKAGE_VERSION> -Source <PACKAGE_SOURCE_URL> -ApiKey <KEY>
    

Note

Azure DevOps and Visual Studio Team Foundation Server interpret the nuget.exe delete command as an unlisting operation. To delete a package, you must use the REST API or delete it manually from the web interface.

Delete packages permanently

Packages placed in the Recycle Bin are permanently deleted after 30 days, but they continue to contribute to your storage costs during that time. If you wish to remove them before this period, you can manually delete them from the Recycle Bin by following these steps:

  1. Sign in to your Azure DevOps organization, and then navigate to your project.

  2. Select Artifacts, and then select your feed from the dropdown menu.

  3. Select Recycle Bin from the upper-right corner.

    A screenshot showing how to access the recycle bin in Azure Artifacts.

  4. Select the package you want to permanently delete, and then select Permanently Delete.

    A screenshot showing how to permanently delete a package in Azure Artifacts.

  5. Select Permanently Delete once more to confirm your decision. Your package will be deleted permanently.

    A screenshot showing a confirmation message before you delete a package permanently.

Delete packages automatically with retention policies

The number of versions for each package hosted in your feed can grow quickly. To free up storage space, you can set up retention policies to automatically delete old packages.

If you want to retain a package indefinitely, you can promote it to a view. Packages promoted to a view are exempt from retention policies and will not be subject to deletion. To configure retention policies for your feed, please follow the steps below:

Note

Azure Artifacts does not support package demotion.

  1. Navigate to your project http://ServerName:8080/tfs/DefaultCollection/<ProjectName>.

  2. Select Build and Release, and then select Packages.

  3. Select the gear icon gear icon to access your feed's settings.

  4. From the Retention tab, specify a value for both the Maximum number of versions per package and Days to keep recently downloaded packages.

    • Maximum number of versions per package: The number of versions for each package you wish to retain.
    • Days to keep recently downloaded packages: Packages will only get deleted if they haven't been downloaded for the specified number of days indicated here.
  5. Select Save when you're done.

Note

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

  • The number of published versions reaches the Maximum number of versions per package limit.
  • A version of that package has not been downloaded for the period specified in Days to keep recently downloaded packages.

Restore deleted packages

Deleted packages remain in the Recycle Bin for 30 days. After this period, they'll be permanently deleted. You must be a feed Owner to restore deleted packages.

  1. Navigate to your project http://ServerName:8080/tfs/DefaultCollection/<ProjectName>.

  2. Select Build and Release > Packages, and then select Recycle Bin.

  3. Select your package, and then select the package version that you want to delete.

    Screenshot that shows the package in the Recycle Bin in Team Foundation Server.

  4. Select Restore to feed.

    Screenshot that shows the button for restoring to feed in Team Foundation Server.

Q&A

Q: What is the difference between Deprecate, Unlist, Yank, and Delete a package version?

A: Deprecate applies to npm packages, Yank applies to Cargo packages while Unlist applies to NuGet packages. You can also Delete any of the package types (npm, Maven, Python, Cargo, and Universal Packages):

  • Deprecate (npm): When you deprecate a package version, a warning message is added to the package's metadata. Azure Artifacts and most npm clients will display this warning message whenever the package is viewed or installed.

  • Unlist (NuGet): Unlisting a package version hides it from the search results in Azure Artifacts feeds and on NuGet.org.

  • Yank (Cargo): Yanking a package version marks it as obsolete or deprecated, discouraging its use, but it doesn't delete the package.

  • Delete: Deleting a package version makes it unavailable to install. Deleted packages can be restored from the Recycle Bin within 30 days of deletion. After this period, the packages will be permanently deleted.

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

A: Old or existing packages will be soft-deleted and moved to the Recycle Bin. The deletion job runs once a day, but there might be an initial delay after the policy is turned on for the first time because of an influx of packages.

Packages remain in the Recycle Bin for 30 days before they're permanently deleted. To remove the packages from your billable storage, you can choose to delete them manually by using the UI or the REST API before the 30 days are up.

Q: How long does it take for the billed storage amount to update after deleting Artifacts?

A: Typically, storage consumption should be updated within 24 hours, although in certain cases it might take up to 48 hours for the changes to be reflected. The Artifacts usage on the billing page of your organization is updated once a day. However, The Artifact Storage page is updated more frequently, which may lead to a minor discrepancy between the information displayed on the two pages.