Creating a TFVC Repository in Azure DevOps and Linking It to Source Control

April 29th, 2021

The article provides a complete walkthrough to help you create a TFVC repository in Azure DevOps and link your database to the repository via the Source Control tool by dbForge. You will be able to version control your database and keep a history of changes.

Why We Need Azure Repos

Azure DevOps provides a set of end-to-end DevOps tools that assist teams in planning, working together on code development, and deploying applications. The platform incorporates a range of features to help you boost productivity and facilitate your database development and deployment. In this article, we want to focus on a specific service integrated into Azure DevOps that provides free cloud-hosted repositories. Azure Repos gives you an opportunity to create your own repository using Git or Team Foundation Version Control (TFVC).

Using a version control system contributes greatly to the success of your project. With its help, you can stay abreast of the changes delivered into the code, check the development history, and roll back the changes to any version if needed. Apart from that, a version control system allows establishing flawless coordination across the teams working on the same project.

What is TFVC?

Team Foundation Version Control (TFVC) is a centralized version control system that delivers all the required features to support the database development process. As a rule, every team member gets only one version of each file on the dev machine. The history of changes is stored only on the server, and branches are path-based and created on the server.

Using TFVC, you can implement granular permissions and limit access down to a file level. And since your team checks in all their work into your Team Foundation server, you can easily examine changes, find out which user introduced a changeset, and determine the exact changes the user made.

Getting Started With Azure DevOps

For starters, you will need to create a new Azure DevOps project. To create a project, you need to go to the official website and sign up. If you haven’t signed in to your Microsoft account, you will first need to enter your credentials. Click Start free:

Start an Azure DevOps project

Next, specify a country/region where you reside and click Continue:

Specify your county of residence

Following that, indicate the name of your Azure DevOps organization, select where you would like your projects to be hosted, and enter the characters below. Click Continue:

Name your Azure DevOps organization

Now, you can start creating your project:

  1. Specify a name for your project and set the visibility depending on whether you want your project to be private or public.
  2. Enter a project description if necessary.
  3. Select a version control system for your project. In the present case, we choose Team Foundation Version Control (TFVC).
  4. Choose a process template based on your needs. You are free to choose from Basic, Agile, CMMI, and Scrum processes.

Once you are finished, click Create project:

Create a project and choose a version control system

Congrats! You have created a project as well as a new repository in Azure DevOps. Note that the name of the repository corresponds to the name of the project:

A new TFVC repository

If you created a private project, make sure you add users to access your project repository. This step is important to further link your database to source control.

Linking a Database to Source Control

Now that you are all set and ready, you can use a reliable tool to manage code changes in your database project. We are going to apply dbForge Source Control for SQL Server. This convenient SSMS add-in helps version-control database schemas and table static data while preserving database integrity. To go on with the tutorial, install the product and open SQL Server Management Studio.

To link your database to a TFVC repository, in Object Explorer, right-click a database you want to link to source control:

Initiate database linking to Source Control

In the Wizard that opens, you need to click the plus icon in the Source control repository field to build a connection to your repository:

Link Database to Source Control Wizard

In the new Wizard, you need to choose Team Foundation Version Control as your source control system. Then, you will have to specify the server URL, which in your case will be similar to the following –https://dev.azure.com/Organization_Name.

Specify the TFVC repository properties

After that, choose the authentication type. Since the Base authentication type is not recommended due to its low-security level, you should opt for either Token or Web authentication type. In the former case, you will need to obtain an authorization token in the Azure DevOps security settings:

Choose an appropriate authentication type
Obtain a personal access token in the security settings

If you opt for the latter authentication type, you will be prompted to enter a Username and Password for your web account:

Enter the credentials for your web account

Next, you will need to specify the Database folder name, which is the name of your Azure DevOps repository. Note that the name of your repo was generated automatically from the project name at the project creation stage. You can enter the name manually in the Database folder field or click the ellipses and choose the name in the window that appears. It is recommended to create a new folder within your Azure DevOps project. Click Test. If you have successfully connected to your repository, click OK:

Successfully connected to Source Control

Following that, you will be sent back to the Link Database to Source Control Wizard. Here, you need to select a database development model and then click Link:

Choose a database development model

If you have linked your database to source control successfully, a database icon in Object Explorer will be changed to show that a database is linked:

Ensure that you database is linked to source control

You can now start introducing changes to your database, committing them, and keeping track of all alterations within a handy interface of the tool. Besides, you have the possibility to reap the benefits of both tools and automate your database development with the DevOps approach.

Leave a Comment