We have an on-premise Team Foundation Server (2015) which we use for our source control. Everything is installed on the one vm; TFS and SQL Server (also SQL Reporting Services and Analysis Services but we don't actually use them).
Our plan was to move the database to a new server, including the TFS Configuration database. This was so that we could uninstall SQL Server.
The steps taken:
- As it was a virtual machine we were able to create a snapshot of it before we moved anything, always good just in case a rollback is required.
- Login to the vm as an account with full TFS permissions
- Open the administration console window and select Team Project Collections, then Detach the collection.
- Close the administration console when completed.
- Perform a SQL backup of the TFS_ databases.
- Restore the SQL backups to the new SQL Server
- Grant the TFS Service account DBO access to the databases and add any logins.
- Stop IIS, open a command prompt:
- IISReset /Stop
- Stop the TFS Services:
- Team Foundation Ssh Service
- Visual Studio Team Foundation Background Job Agent
- Visual Studio Test Controller
- Open a (elevated) command prompt
- CD C:\Program Files\Microsoft Team Foundation Server 14.0\Tools
- TfsConfig registerDb /sqlInstance:<NewSQLServer> /databaseName:Tfs_Configuration
- Note: If the command prompt hangs, give the TFS Admin account higher SQL permissions.
- Open the administration console window and select Application Tier, then Reapply account.
- Disable the SQL Server services (to be sure that it is not being used).
- SQL Server
- SQL Server Agent
- SQL Server Analysis Services
- SQL Service Integration Services
- SQL Server Reporting Services
- In the TFS Administration Console select Team Project Collections and Attach the collection: