
You can restore deleted resources from the Azure DevOps Recycle Bin within 90 days of deletion.
The Recycle Bin is a temporary storage area for deleted resources, such as projects, teams, and repositories.
To restore a deleted resource, navigate to the Recycle Bin, select the resource you want to restore, and click the Restore button.
Restored resources will be returned to their original state, with all associated data and settings intact.
Deleting Projects and Repositories
Deleting projects and repositories in Azure DevOps is a straightforward process. You can delete a project using your web browser, and it will be permanently deleted if not restored within 28 days.
To delete a project, sign in to your organization, select Organization settings, and then select Projects. Check one or more projects to delete, and then select Delete.
When deleting a project, you have two options: soft-delete or hard-delete. Soft-delete allows you to restore the project within 28 days, while hard-delete permanently deletes the project and is not subject to restoration.
You can also use the Azure DevOps Administration Console to delete a project from a project collection. This requires administrator permissions and involves deleting external data associated with the project.
The project deletion process can be summarized in the following steps:
- Sign in to your organization
- Select Organization settings
- Select Projects and check one or more projects to delete
- Select Delete and confirm the deletion
Alternatively, you can use the TFSDeleteProject command line tool to delete all artifacts associated with the project. This is a more advanced option that requires specific permissions and knowledge.
Git Deleted Repository
A Git deleted repository is essentially a repository that has been permanently removed from Azure DevOps. This means it's gone for good, unless you're able to recover it using a tool.
The GitDeletedRepository object contains several properties that provide information about the deleted repository. Here are some of the key properties:
If you're looking to recover a deleted repository, you might want to check out the article "How to Recover Deleted Azure DevOps Repository?" which covers the topic in more detail.
Delete Project
Deleting a project in Azure DevOps can be done in two ways: a soft delete or a hard delete.
A soft delete is performed using your web browser, and after 28 days, the project is permanently deleted if not restored within that time. To initiate a soft delete, sign in to your organization, select Organization settings, and then select Projects. Check one or more projects to delete and select Delete.
To confirm deletion, enter the project name and select Delete in the popup screen. Your project is deleted and can be restored up to 28 days afterward. Your deleted project is removed from your projects list.
You can also delete a project from the Azure DevOps Administration Console, which performs a hard delete. Projects are permanently deleted and not subject to restoration.
Here's a step-by-step guide to hard delete a project:
- If you're not a member of one or more of the following administrator groups, get permissions now:
- Project Collection Administrators
- Project Administrators
- Project Collection Build Administrators
- Open the administration console and delete the project from its project collection.
- Choose whether to delete external data associated with the project and then start the delete action.
You can also use the TFSDeleteProject command line tool to delete all artifacts associated with the project.
Restore Project via API
You can restore a project in Azure DevOps via API, and it's a great way to recover deleted projects. The API method allows you to restore a project even if the UI doesn't support it, like in Azure DevOps Server 2019.
To restore a project with the REST API, you'll need to make a PATCH request to the project's URL. The request should include the API version and a JSON body with the "state" property set to "wellFormed".
Here's a step-by-step guide to restore a project with the REST API:
1. Get a list of deleted projects by making a GET request to the _apis/projects endpoint with the stateFilter parameter set to deleted.
2. Find the project you want to restore by its ID or name in the list of deleted projects.
3. Make a PATCH request to the project's URL with the API version and the JSON body with the "state" property set to "wellFormed".
You can also use PowerShell to restore a project via API. The script will get a list of deleted projects and then restore the one you specify.
Here are the PowerShell script commands to restore a project:
1. Get a list of deleted projects by making a GET request to the _apis/projects endpoint with the stateFilter parameter set to deleted.
2. Use the list of deleted projects to find the one you want to restore by its name.
3. Make a PATCH request to the project's URL with the API version and the JSON body with the "state" property set to "wellFormed".
Note that when restoring a project, you may need to rename the project if it has the same name as another existing project.
Prerequisites and Management
To use the Azure DevOps Recycle Bin effectively, you need to understand the prerequisites and management requirements.
To access the Recycle Bin, you need to have the Area Path permission set to Allow: Edit work items in this node, which is granted to members of the Contributors group by default.
For deleting and restoring work items, you need to have the project-level permission set to Allow: Delete and restore work items, which is also granted to members of the Contributors group by default, and requires Basic access or higher.
You can't permanently delete work items without having the project-level permission set to Allow: Permanently delete work items, which is granted to members of the Project Administrators group by default.
Here's a summary of the required permissions:
These permissions are crucial for managing work items in the Recycle Bin, so make sure to check your access levels before attempting to delete or restore work items.
Sources
- https://learn.microsoft.com/en-us/rest/api/azure/devops/git/repositories/get-recycle-bin-repositories
- https://learn.microsoft.com/en-us/azure/devops/organizations/projects/delete-project
- https://learn.microsoft.com/en-us/azure/devops/boards/backlogs/remove-delete-work-items
- https://itbackyard.com/how-to-recover-deleted-azure-devops-repository/
- https://www.delta-n.nl/azure-devops-ninja/
Featured Images: pexels.com