title: How to delete unwanted artifacts in Azure DevOps
body: <p>Our developer teams produce many NuGet packages which are published to Azure DevOps Artifacts feed. Most of them become unwanted over a week or two. </p>
  
  <p>How can I select which artifacts should be covered with retention? Azure provides only general configuration, basically allowing only to specify a time after which artifacts will be retained.
  I was thinking about some sort of job which would select artifacts that match my criteria and delete them, but I'm afraid Azure DevOps REST API does not provide such functionality as Artifact deletion.</p>
  
  <p>For example, I'd like to cover all pre-release packages with retention policy.</p>
  
  <p>You can check your artifacts storage here (mind the placeholder)
  <code>https://dev.azure.com/&lt;org&gt;/_settings/storage</code></p>
  
  <p>Retention policies overview <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/policies/retention?view=azure-devops&amp;tabs=yaml" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/devops/pipelines/policies/retention?view=azure-devops&amp;tabs=yaml</a></p>
  
  <p>Artifacts how-to
  <a href="https://docs.microsoft.com/en-us/azure/devops/artifacts/how-to/delete-and-recover-packages?view=azure-devops&amp;tabs=maven" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/devops/artifacts/how-to/delete-and-recover-packages?view=azure-devops&amp;tabs=maven</a></p>
  
  <p>Artifacts docs at Azure DevOps REST API
  <a href="https://docs.microsoft.com/en-us/rest/api/azure/devops/build/artifacts/get%20artifact?view=azure-devops-rest-5.1#artifactresource" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/rest/api/azure/devops/build/artifacts/get%20artifact?view=azure-devops-rest-5.1#artifactresource</a></p>