title | description | ms.technology | ms.assetid | ms.custom | ms.topic | ms.date | monikerRange |
---|---|---|---|---|---|---|---|
Delete and recover packages | Azure Artifacts |
Recover deleted packages and set up policies to automatically delete packages hosted in Azure DevOps Services and Team Foundation Server (TFS) |
devops-artifacts |
10f5e81f-2518-41b9-92b6-e00c905b59b3 |
contperf-fy21q2 |
conceptual |
10/13/2020 |
>= tfs-2017 |
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.
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.
There are two options available to remove a version of an npm package from a feed.
- Deprecate: deprecating a version of a package adds a deprecation message that most npm clients, and Azure DevOps Services, will show whenever the package is viewed or installed. Deprecating a version can help you discourage new usage of it by presenting a warning message when the package is installed.
- Unpublish: Unpublishing a version of a package makes it unavailable to install. Unpublished packages can be restored from the Recycle Bin within 30 days of deletion. After 30 days, the package will be deleted permanently.
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.
::: moniker range=">= azure-devops-2019"
You must be a contributor to deprecate a package and an owner to unpublish it.
From within your feed, select the appropriate package and select Deprecate or Unpublish.
::: moniker-end
::: moniker range=">=tfs-2017 < azure-devops-2019"
You must be a contributor to deprecate and an owner to unpublish.
Select Build and Release, then Packages. select the appropriate package and select Deprecate or Unpublish.
::: moniker-end
- You must first set up your client's npmrc.
- To deprecate a package, run the following command:
npm deprecate <package>[@<version>] <message>
- To unpublish a package, run the following command:
npm unpublish <package>@<version>
Note
npm unpublish
will not unpublish all versions of the package.
See the deprecate or unpublish npm documentation for more info.
There are two options available to remove a version of a NuGet package from a feed.
- Unlist: Unlisting a package version hides it from the search results, Visual Studio UI and from appearing on NuGet.org.
- Delete: Deleting a version of a package makes it unavailable to install. Deleted packages can be restored from the Recycle Bin within 30 days of deletion. The packages will be deleted permanently afterwards.
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.
::: moniker range=">= azure-devops-2019"
You must be a contributor to unlist a package and an owner to delete it.
From within your feed, select the appropriate package and select Unlist or Delete latest.
::: moniker-end
::: moniker range=">=tfs-2017 < azure-devops-2019"
You must be a contributor to unlist a package and an owner to delete it.
Select Build and Release, then Packages. select the appropriate package and select Unlist or Delete latest.
::: moniker-end
-
Navigate to your feed and select Connect to feed
::: moniker range=">= azure-devops-2019"
::: moniker-end
::: moniker range=">=tfs-2017 < azure-devops-2019"
::: moniker-end
-
Select NuGet.exe then find and Copy the Package Source URL.
-
Run the following command:
nuget.exe delete {your_package_id} {version} -Source {feed URL} -ApiKey key
NuGet.exe currently only performs the unlist packages operation. Azure DevOps Services and TFS interpret the nuget.exe delete
command as an unlist operation. To delete a package, you must use the REST API or the web interface.
You must be an owner to delete a Python package.
From within your feed, select the appropriate package and select Delete latest.
You must be an owner to delete a Universal Package.
From within your feed, select the appropriate package and select Delete latest.
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.
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:
::: moniker range=">= azure-devops-2019"
-
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.
::: moniker-end
::: moniker range=">=tfs-2017 < azure-devops-2019"
-
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.
::: moniker-end
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.
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.
::: moniker range=">= azure-devops-2019"
-
Select Azure Artifacts.
-
Select "Recycle Bin".
-
Select the appropriate package then select the package version.
-
Select Restore to feed.
::: moniker-end
::: moniker range=">=tfs-2017 < azure-devops-2019"
-
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.
::: moniker-end