As mentioned at the end of the previous entry, the new DevOps server requires the old one to be online because that is where the SQL database is stored.

Now, if we will be keeping SQL on that server, we do not have to change anything, and we can continue with our environment as is. But, if we want it to be self contained (SQL database stored on the DevOps server), we will need to migrate that over as well.


We need to start by installing an SQL server to host the database. I will be installing SQL Express 2019. We will also need SQL Server Management Studio 18.

After installing those, we can get started migrating the database over.



We’ll start by exporting the database from TFS, so launch the Azure Devops Server Administration Console.

First we need to stop the existing collection so we can create a good backup. Give a reason in the window that pops up.

Stop the Project collections

Next head over to Scheduled Backups area, and choose Create Scheduled Backups.

Scheduled Backups

Go through the prompts, choosing a location to save the backups, selecting that we will only be doing manual backups (or setup an automated schedule!)

Schedule backups options Schedule backups options

Verify that the configuration is correct

Verify options

Next actually create the backup

Create backup



«NOTE»
I initially tried using an admin share (C$\sharename) but kept getting tf400983 Access to path denied. Even after adjusting permissions on that directory. Switching that to a standard share worked fine


Once the backup finishes, we move onto importing the database on the new server.

Backup success

Now we will click on Restore Backups

Change the backup to match the latest one we created (you may need to click List Backups first)

Restore backups

Next we will change the SQL Server Instance to be our new server

Change server instance to new server

Verify everything is correct, and then continue.

Verify all options

Everything should have succeeded, if not go back and fix it until it does

Everything succeeded

Now for the slightly more difficult part. I couldn’t find any easy way to change the application tier to point to the new database, but there was a post on Stack Overflow that shows how we can do it from the command line.

Navigate to the installation directory of Azure DevOps, and run the tfsconfig.exe command.

tfsconfig.exe command

Look through the documentation that is provided until you feel comfortable with these commands.

We need to use the RegisterDB command

Registerdb command

After running that command, if we return to the DevOps management console, we can see that the SQL server has been updated. Now we start the instance again, and we are good to go.

success in changing SQL source





«Notes»

  1. I had issues getting the database to backup from the management console because of the network share, try using a new (non admin) share if you have issues
  2. For SQL Express, remember you may need to put SQLEXPRESS in the connection name instead of just the machine name
  3. Did you catch that each of the images the backup creation have different paths? Going back to note 1, the one I ended up using successfully was \MachineName\Backups - I created a Directory on my C: drive and shared it as backups
    The backup wizard did not like trying to use a local only address (127.0.0.1) and required the use of a machine name