Muokkaa

Jaa


Delete a project

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019

If a project becomes obsolete, you can delete it from your organization or collection in Azure DevOps. Likewise, if you're migrating from an on-premises Azure DevOps Server to Azure DevOps Services, it might be necessary to delete the project. The removal of projects can also enhance navigation by restricting it to only those projects that are currently in use.

Caution

  • Soft-deleted projects from the web portal are permanently removed if not restored within 28 days.
  • In rare cases, our deletion process might take up to 70 days due to backend retries and the need to delete data from multiple sources.
  • Hard-deleted projects from the on-premises Azure DevOps Administration Console cannot be restored. For more information, see Restore a project and Save project data.

Prerequisites

  • Permissions: Have the Delete team project permission set to Allow. For more information, see View permissions.
  • Optional: Save project data, as deleting a project results in irreversible data loss.

Save project data

Use the following procedures to save data that users most care about, such as source code, build data, and work items. This procedure is optional and something you might consider before you delete a project.

  • Source code and custom build templates: Download your files as a zip file. Select Repository actions for the repository, file, or folder and select Download as Zip. Or, select Download to download either all of the files in the currently selected folder, or the currently selected file.

    Screenshot of Downloading code.

    This process doesn't save any change history or links to other artifacts. If you use Git, clone your repositories to retain the full project history and all the branches.

  • Build data: To save logs and data in your drop build folders, see View build results.

  • Work item tracking data: Create a work item query and open it using Excel. Save the Excel spreadsheet.

    This process doesn't save any attachments, change history, or links to other artifacts.

For more information, see our Data Protection Overview.

Delete project

Use your web browser to perform a soft-delete. After 28 days, projects are permanently deleted if not restored within that time.

  1. Sign in to your organization (https://dev.azure.com/{yourorganization}).

  2. Select gear icon Organization settings.

    Screenshot of selection, Organization settings.

  3. Select Projects, check one or more projects to delete, and then select Delete.

    Screenshot of sequence selected Projects, check each project, and delete.

  4. Confirm deletion by entering the project name, and then select Delete in the popup screen.

    Screenshot of popup confirmation delete project screen.

Your project is deleted and can be restored up to 28 days afterward. Your deleted project is removed from your projects list.

Delete reports that remain after deleting a project

If your project used SQL Server reporting and you didn't delete external artifacts, you can delete the reports using SQL Server Report Manager. From the project collection page, delete the folder that corresponds to the deleted project.

Screenshot of the context menu with delete command.

Restore a deleted project

If you inadvertently delete a project in Azure DevOps, you can restore it within 28 days of its deletion.

  1. Sign in to your organization (https://dev.azure.com/{yourorganization}).

  2. Select gear icon Organization settings.

    Screenshot showing the gear icon, Organization settings.

  3. Select Overview, and then scroll down to "recently deleted projects."

    Screenshot that shows recently deleted projects.

  4. Highlight the project you want to restore, and then select Restore.

    Screenshot showing highlighted project, and Restore button.

  1. Sign in to your instance (http://{ServerName:8080/tfs/}/{CollectionName}).

  2. Choose gear icon Admin settings.

    Screenshot showing Admin settings button surrounded by red box.

  3. Select Projects, and then scroll down to Recently deleted projects.

  4. Highlight the project you want to restore, and then select Restore.

    Screenshot showing how to Highlight the project, and then select Restore for Azure DevOps Server.

Note

The UI doesn't support restoring a team project for Azure DevOps Server 2019. Use the following REST API or PowerShell methods to restore a deleted team project. For more information, see Projects-Update REST API.

Restore project with REST API

Warning

To restore a project with a name that's already taken, you must rename the project before you can restore it. To rename the project, enter the following text in the request body: "name":"new name"

  1. Open a browser window and enter a URL that uses the following form:

    'http://ServerName:8080/tfs/DefaultCollection/ProjectName'

    For example, to connect to the server named FabrikamPrime, enter: 'http://FabrikamPrime:8080/tfs/'.

    The default Port is 8080. Specify the port number and directory for your server if defaults aren't used.

  2. Get a list of deleted projects using the following request:

    GET http://ServerName:8080/tfs/DefaultCollection/_apis/projects?stateFilter=
    deleted&api-version=5.0-preview.3
    
  3. Restore a deleted project using the following request:

    PATCH http://ServerName:8080/tfs/DefaultCollection/_apis/projects/{projectId}?
    api-version=5.0-preview.3
    

    Request body

    {
     "state" : "wellFormed"
    }
    

Restore project with PowerShell

  1. Execute the following PowerShell script to get a list of deleted projects and make sure to update $collectionUrl.

    $collectionUrl = "https://localhost/defaultcollection"
    (irm -Uri "$collectionUrl/_apis/projects?stateFilter=
    deleted&api-version=5.0-preview.3" -UseDefaultCredentials).value
    

    Something similar to the following screenshot appears: Screenshot of PowerShell script return example for deleted projects.

  2. Use the following script to restore a project. Be sure to update $collectionUrl and $projectName.

    $collectionUrl = "https://localhost/defaultcollection"
    $projectName = 'Project1'
    $project = (irm -Uri "$collectionUrl/_apis/projects?stateFilter=
    deleted&api-version=5.0-preview.3" -UseDefaultCredentials).value
     | where {$_.name -eq $projectName}
    irm -Uri ($project.url + "?api-version=5.0-preview.3") 
    -UseDefaultCredentials -Method PATCH -Body '{"state":"wellFormed"}'
     -ContentType 'application/json'
    

Your project and associated data are restored.

FAQs

See the following frequently asked questions about deleting projects in Azure DevOps.

A: Work items get deleted within 24 hours after your project is deleted.

Q: I deleted a project in Azure DevOps, but in Visual Studio Team Explorer it's still there, what do I do?

A: Wait 28 days before the project is permanently deleted.