Thursday, April 18, 2024
HomeHow ToCreating a TFVC Repository in Azure DevOps and Linking It to Source...

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

During software development, it is critical to maintain a structured and traceable history of changes. This can be easily achieved with version control systems that allow you not only to version-control data but also commit, track or roll back changes, resolve conflicts, switch between branches or manage merge operations.

In the article, we’ll guide you through the step-by-step process of establishing a TFVC repository in Azure DevOps and linking your database to it using the dbForge Source Control tool. It helps you version control your database and keep a history of changes. In addition, we’ll cover some basics of Azure repositories, delve into TFVC as a version control system, and outline the importance of using them from the beginning of your project development.


Why do we need Azure Repos?

Azure DevOps provides end-to-end DevOps tools that assist teams in planning, working together on code development, and deploying applications. The platform incorporates various 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 allows you to create your repository using Git or Team Foundation Version Control (TFVC).

Using a version control system contributes significantly 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 establishes 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 database development. 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 to a file level. And since your team checks all their work into your Team Foundation server, you can quickly examine changes, find out which user introduced a changeset, and determine the exact changes the user made.

Introduce version control comparison

Given that Git is the most widely used version control system let’s outline the main differences between TFVC and Git:

  • TFVC adheres to a centralized version control model featuring a client-server architecture, while Git uses a distributed approach. This difference gives Git greater flexibility, allowing you to seamlessly work with a local copy of the remote repository and quickly execute tasks such as branch switching or merging.
  • TFVC stores changes on a per-file basis tracked through changesets. In contrast, Git captures a committed file as a snapshot, facilitating straightforward revert or undo operations.

For a more detailed comparison of TFVC and Git, see the Microsoft documentation.

So, which version control system to choose for database versioning depends on the development team’s preferences and the specific requirements of the project. While TFVC excels in structured branching, Git’s flexibility and comprehensive tooling make it a preferred choice for modern development workflows, especially when seamless database versioning integration is crucial.

Early adoption emphasis

Let’s now discuss the early adoption of version control, especially TFVC for database versioning. It is worth saying that it is not merely a best practice but a strategic investment in the success and sustainability of software development projects. Here are key points highlighting the importance of early adoption:

  • Change tracking and history:
    TFVC allows developers to track changes made to the database over time. Every modification is recorded, providing a comprehensive history of alterations to the database schema. It, in perspective, may help understand database development and troubleshooting issues.
  • Collaboration and teamwork:
    Early adoption of TFVC facilitates developers to work concurrently on different aspects of the database without the risk of conflicting changes. Version control helps merge these changes seamlessly, promoting a collaborative and efficient development environment.
  • Risk mitigation:
    Version control allows developers to roll back changes in case of errors or unexpected issues, thus reducing the risk associated with database modifications and providing a reliable mechanism for recovering from unforeseen challenges.
  • Consistency across multiple environments:
    With version control, developers can ensure consistency between database versions across different environments, such as development, testing, and production. This capability ensures that everyone works with the same database schema baseline, minimizing the likelihood of deployment.
  • Code reviews and auditing:
    TFVC facilitates code reviews by providing a clear view of the changes made to the database. This enhances the code quality by allowing team members to review modifications, provide feedback, and ensure that coding standards are adhered to. Additionally, version control logs can serve as an audit trail for compliance and regulatory purposes.
  • Automated build and deployment:
    Version control is a fundamental element for implementing automated build and deployment pipelines. By integrating TFVC into these processes, developers can automate the testing and deployment of database changes, reducing manual errors and accelerating the release cycle.
  • Adaptation to change:
    Early adoption of TFVC instills a version control mindset within the development team. This mindset is essential as projects evolve, teams grow, and requirements change. Developers accustomed to version control are better equipped to handle the dynamic nature of software development.
  • Continuous Integration and Continuous Delivery (CI/CD):
    TFVC is integral to implementing CI/CD practices, allowing for the continuous integration and delivery of database changes. Early adoption ensures that the development process aligns with modern DevOps practices, leading to faster and more reliable software releases.

As projects grow in complexity, having a robust version control system like TFVC becomes increasingly essential. Early adoption establishes a solid foundation for scaling development efforts and accommodating the evolving needs of the project.

Getting Started With Azure DevOps

To begin, create a new Azure DevOps project by going to your Azure DevOps account and clicking Start free to sign up.

Log in to the Azure DevOps account

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

Get started with Azure DevOps

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. To proceed, click Continue:

Indicate the name of your Azure DevOps organization

Done! The organization has been created. So, let’s now build your project.

In your organization –, click + New project in the upper-right corner of the page.

Initiate the process of creating the project

In the Create new project dialog that opens, specify the project details:

  • In the Project name field, specify the name of your project.
  • Optional: In the Description field, add detailed information describing your project.
  • Under Visibility, select Public to make your project visible to anyone on the Internet or Private to make the project visible only to the users to whom you grant access.
  • Expand the Advanced options, select Team Foundation Version Control as a version control and a process template based on your needs. The available templates are Basic, Agile, CMMI, and Scrum processes.

Click Create to create the project. 

Create a project in the Azure DevOps account

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

View the project and repository in the Azure DevOps account

If the project is private, 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’ll utilize dbForge Source Control for SQL Server that can be easily integrated into SQL Server Management Studio (SSMS) as an add-in. The tool 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. Additionally, watch this video to discover how dbForge Source Control is involved in the DevOps process.

To link your database to a TFVC repository, in Object Explorer, right-click the database you want to link to source control and select Link Database to Source Control:

Link a database to source control in dbForge Source Control

In the Link Database to Source Control dialog that opens, click the plus icon in the Source control repository field to establish a connection to your repository:

Specify the details for the repository

In the Source Control Repository Properties dialog that opens, select Team Foundation Version Control (TFVC) as a source control system from the Source control system dropdown list and specify Server URL, for example,

Enter the repository details

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 the Token or Web authentication type.

Choose the authentication type

In the case of the Token authentication type, you will need to obtain an authorization token in the Azure DevOps user settings:

Obtain an authorization token in the Azure DevOps user settings

If you opt for the Web authentication type, enter a Username and Password for your web account.

Enter a Username and Password for your web account

Next, specify the Database folder name, which is the name of your Azure DevOps repository. Note that the name of your repository is 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 that you create a new folder within your Azure DevOps project.

Click Test to verify that the database can be successfully connected to source control. To proceed, click OK:

Verify that the database can be successfully connected to source control

Next, select a database development model and click Link:

Select a database development model

Upon the successful connection of the database to source control, the database will get the following icon in Object Explorer:

View the linked database in Object Explorer

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


In the article, we have briefly explored the importance of Azure DevOps and TFVC, emphasizing the advantages of adopting a version control system from the project’s start. We also provided a step-by-step guide on linking your database to a TFVC repository using the robust SSMS add-in – dbForge Source Control for SQL Server.

In addition, dbForge Source Control extends its support beyond TFVC to encompass a range of popular version control systems, including Apache Subversion (SVN), Git, Mercurial (Hg), Perforce (P4), and SourceGear Vault. The tool can also version-control database schemas and static table data, commit and revert changes, view and resolve conflicts, and allow users to track changes in the history of changes.

Download a trial version of dbForge Source Control as a part of the SQL Tools pack and enjoy the advanced features and functionalities for free within 30 days.