Visual Studio Team Services (VSTS) is the Software as a Service (SaaS) Microsoft offering for source code management (e.g., using Git), CI/CD pipelines, etc. It enables users to mix and match the tools they use in various stages of the pipeline from source code repositories, build engines, and deployment orchestration tools. As I have discussed previously, VSTS may not be the right fit for all organizations and in some cases, the right solution may be a private deployment of Team Foundation Server (TFS) in Azure. I have published various templates for TFS in Azure and High Availability (HA) TFS in Azure. You can find the templates in my Infrastructure as Code (IaC) GitHub repository.
Organizations that prefer to run private TFS deployments in Azure may also use tools such as GitHub Enterprise to store their source code. In this blog post, I will show how to set up a CI/CD pipeline in TFS using a GitHub Enterprise source code repository. I have used the HA TFS DevOps template mentioned above to set up a Domain Controllers, SQL Always On, TFS, and a jump box to test the setup. Additionally, I added a GitHub Enterprise VM using the Azure GitHub Enterprise Market Place template. The complete setup looks something like this:
To set up a build pipeline, you first need to make a service connection from TFS to GitHub Enterprise. First go to Services and hit "New Services Endpoint":
Pick External Git Repository and fill in the details:
The Server URL should be the full URL to the git repository, e.g.
https://ghe.cloudynerd.com/mihansen/testproject.git. Now you are ready to set up a build. Here is an example of an ASP.NET build using the GitHub Enterprise repository as a remote repository:
If you would like continuous integration, make sure you enable the trigger:
If you would like continuous deployment, you will need to add a deployment configuration as well.
And that is it. You can run a private deployment of TFS in Azure and use GitHub Enterprise (in Azure) as the source code repository for your CI/CD pipeline.
Let me know if you have questions/comments/suggestions.