64

I have got a project in an old org (from VSTS), that I want to move to my new one.

I can't see any options in Azure DevOps on migrating projects, or any information on the interwebs.

Anyone know how to do it?

peterh
  • 11,875
  • 18
  • 85
  • 108
RPM1984
  • 72,246
  • 58
  • 225
  • 350
  • If you are using AzureAD for managing your organization then you can follow [this](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/disconnect-organization-from-azure-ad?view=vsts) – Jayendran Nov 19 '18 at 03:07
  • Please change the accepted solution, @martin answer is the most accurate way to do it – David Noreña Apr 15 '21 at 14:49

9 Answers9

53

If you just need to move repos, you can use the built in clone functions:

  1. Go to the Azure Devops source repo -> Files
  2. Click "Clone"
  3. Choose "Generate Git Credentials"

Generate GIT credentials

  1. Create the target repo in the target Azure DevOps
  2. Choose "Import a repository"
  3. Use the URL and credentials from Step 3

enter image description here

  1. Done
Arulkumar
  • 12,966
  • 14
  • 47
  • 68
Martin Åhlin
  • 2,730
  • 1
  • 20
  • 27
  • 3
    6.5 Change the remote repository for any local repositories to the new repository. You can use `git remote set-url origin https://XXXXX@dev.azure.com/XXXXXX/XXXXX/_git/XXXXXX` (with the https path being the clone url), or manually edit the config file and change the remote. Verify that everything is OK with `git remote -v`. – RonaldB Jan 27 '21 at 19:07
  • this should be the accepted answer, I did it and worked flawlessly – Guilherme Flores Feb 07 '21 at 22:52
  • I did this but it gives me error stating Import request cannot be processed due to one of the following reasons: 1. Clone URL is incorrect. 2.Clone URL requires authorization. My credentials are correct, so it seems it isn't accepting the URL – Avdhut Vaidya Feb 13 '21 at 19:38
  • Ok, I just realized it works. The difference here from my earlier message is that now in my source repository, i clicked "Generate Credentials" and those credentials I passed in my destination User Name & Password fields while importing and it worked!!Earlier I was trying to put my login credentials that I used for my source organization. – Avdhut Vaidya Feb 13 '21 at 19:42
  • 13
    This answer only covers how to migrate repositories from GIT. What about migrating the project management components, etc ... from a project? – GettingItDone Jun 17 '21 at 09:34
  • 2
    This answer would be much more helpful if it included how to move the other 99% of the project to a different org. The git repos are literally the easiest thing to move and really the only thing designed to move easily. This is probably the only thing OP was not asking about. – Bryan Williams Jun 06 '23 at 22:59
34

This is not supported today. But this feature was planned to develop: make it possible to move a Team Project between Team Project Collections

Shamrai Aleksander
  • 13,096
  • 3
  • 24
  • 31
  • 10
    Since this is not an actual solution, I don't think it should be the accepted answer. – CodeGrue Mar 09 '20 at 20:55
  • 9
    @CodeGrue It may not be a solution, but it does answer the question. While some people may find the other solutions to be sufficient for their needs, the reality is that for most this is the right answer: Microsoft just doesn't support it (yet, if ever). It provide me the clarity of knowing I didn't overlook something. – Johan Kool Oct 12 '20 at 11:45
  • It's not a solution only because there is no solution to the question asked. So it should be the accepted answer vs the current accepted answer, which is about moving repos, which is a function of git and not Azure DevOps. I'd argue that it's easier to move repos command line in git rather than using the Azure DevOps process to do it because you have to authenticate each time using the GUI vs once with command line. – DubStep Feb 15 '23 at 17:46
8

If your Azure Devops project only tracks code versions using a single Git repo, hence no boards, user stories, tasks, pipelines, etc. then you can do the following:

  1. Clone your project repo.
    • For example with Visual Studio.
    • You don't need to clone if you already have a local repo.
  2. Destroy the association with the remote.
    • For this typically, you need to open a command line prompt in the folder that contains the .git database folder, most likely the solution folder of Visual Studio and type git remote rm origin.
    • Here is an example using git bash showing the content of the solution folder, including the .git database and the *.sln Visual Studio solution file: enter image description here
  3. Open the solution with Visual Studio if not already done.
    • It should now show that you have many commits waiting to be pushed to a remote. For illustration purpose, my toy project only have 8 commits in total. enter image description here
  4. Click the up arrow and choose your new remote, say a brand new Azure DevOps project, in the organization of your choice, then push.
  5. You are now done cloning the project in another organization. If needed, then destroy the project in the old organization to complete the "move" operation.
Frederic
  • 1,580
  • 15
  • 15
7

There are 3 projects that I know of to achieve this.

A paid for option by Ops Hub - OpsHub Visual Studio Migration Utility

An open source tool that requires making changes to the work item process template - Azure DevOps Migration tools

An lastly an Unofficial but still written by Microsoft tool to create Azure DevOps project templates - Azure DevOps Demo Generator & extractor tool

With the last one (the Demo Generator) you extract the project as a template, then apply it to the new organisation. As it is a tool for demo's there is no support provided and in my experience it works for simple projects but falls over on anything complex.

Sam
  • 602
  • 1
  • 6
  • 10
2

Expanding on others' answers, this post regards Pipelines.

Azure DevOps API

Migrating nearly all aspects of a project across organizations is doable, but it is a lot of manual work using the Azure DevOps API. The link below shows you all the end points, variables, etc. From there you'll probably want to write a Power Shell script and do a couple test runs to a dummy Organization.

https://learn.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-6.1&viewFallbackFrom=azure-devops-rest-6.0

In App options

If you avoid the API, there is no way to migrate pipelines that preserve build or release history, but you can preserve your configurations and processes by going into your Pipelines and selecting View YAML. From here you can either take this away as notes to recreate the GUI steps in your new org/project location, or actually adopt the YAML standard in your git repository.

I do not believe there is a way to migrate pipeline variables outside of the API. However, you can move the variables to Azure Key Vault and change your pipeline settings (YAML) to reference values from key vault. This is not a large amount of effort and is a nice process improvement.

Lastly, if you have any locally installed pipeline agents for releases, you will need to run the Power Shell script for your new organization on the boxes. Very simple 5m step, but right now the Agent Pools are not sharable across organization.

one.beat.consumer
  • 9,414
  • 11
  • 55
  • 98
0

As @Frederic mentioned in his answer, we can actually easily do it with Visual Studio. I have done this without Visual Studio. The steps involved are below.

  1. Add a User to Both Organization
  2. Configure SSH Key
  3. Update the SSH Key in Source DevOps and Clone the Repository
  4. Check out all the Branches and Tags
  5. Update the SSH Key in the Destination DevOps
  6. Remove Old and Add New Origin
  7. Push all the branches

The commands and detailed explanations can be found here.

Sibeesh Venu
  • 18,755
  • 12
  • 103
  • 140
0

BTW, if you need to change the entire Devops Organization tied to your personal Tenant (E.g. VS Enterprise Subscription) and move it to new Tenant, you can change the AAD and point it to the new one e.g. your EA Tenant on Azure commercial cloud.

Before you switch your organization directory, make sure the following statements are true:

  • You're in the Project Collection Administrator group for the organization.
  • You're a member or a guest in the source Azure AD and a member in the destination Azure AD
  • You have 100 or fewer users in your source organization. Otherwise you will have to open a support ticket.
  • You may have to add the users back in destination org if they do not exist becuase they will loose access the moment you switch the AAD.
Andy
  • 2,493
  • 6
  • 37
  • 63
-1

you could just download as a zip file and then download it to the destination repo

BikliWAli
  • 7
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 06 '22 at 07:14
  • Download to destination repo is not the final action. You would need to extract it also, else its just a zip file in the target repo. – Michael Sep 15 '22 at 06:37
  • This answer is wrong on soooo many levels. What about the history, what about the Work Items, iterations, etc... ? – SmartDev Nov 17 '22 at 11:19
-1

The easiest way is to do it from the AzureDevOps porta. Go to your project->Repos->Clone and click on the Clone button.... Step by step guide is here https://sakaldeep.com.np/import-azure-devops-project-to-new-organization/

Sakaldeep Yadav
  • 392
  • 1
  • 6
  • 20