DEV Community

Cover image for Continuous Deployment on Azure with Visual Studio 2019 and GitHub
Daniel Gomez
Daniel Gomez

Posted on

Continuous Deployment on Azure with Visual Studio 2019 and GitHub

Continuous deployment

When talking about continuous deployment we refer to the following definition:

"Continuous deployment is the ability to get changes of all types—including new features, configuration changes, bug fixes and experiments—into production, or into the hands of users, safely and quickly in a sustainable way". Jez Humble.

This definition means that we have several advantages in making use of continuous implementation, among these:

   • Automation of the software publishing process.
   • Improve development productivity.
   • Find and fix errors faster.
   • Deliver updates to users faster.

To understand these concepts quickly and easily, we will carry out the process of continuous implementation of a web application whose development is carried out from Visual Studio 2019, then associate this project with a GitHub repository and with that repository perform continuous implementation towards Azure Web App where our application will be hosted.

Web projects supported in App Service

Before reviewing our implementation example, something very important to mention are the types of projects with which we can carry out continuous implementation with Azure Web App, in this case, Azure supports the following frameworks for web development:

• .NET
• Node.js
• PHP
• Java
• Python
• HTML
• Docker

In this case, our example will be a web application made through the framework: ASP.NET Core 2.2 from Visual Studio 2019. However, for any type of project and / or any IDE of preference, the process will be similar.

PART 1: Associate project in Visual Studio with GitHub

.NET Core 2.2 workload in Visual Studio

Visual Studio: https://visualstudio.microsoft.com/downloads/

Considering that we have the following workload in Visual Studio 2019:

The first thing to do is install the GitHub extension for Visual Studio:

Extension: https://visualstudio.github.com/

To do this, Visual Studio must be closed in order to install the extension since they are changes that are made to the Microsoft IDE.

.NET Core 2.2 in Visual Studio

To do this, Visual Studio must be closed in order to install the extension since they are changes that are made to the Microsoft IDE.

We will proceed to associate the solution that contains the project to a repository in GitHub, for this we right click on the solution and select add solution to the source code control:

Later we go to the Team Explorer view and then to the Synchronization section:

In this case we have the options to publish our project in an Azure DevOps account and in a GitHub account.

When selecting Publish to GitHub, you will be asked to log in if it is the first time and create the repository to which we want to associate the project:

A short time later our project is associated with the repository that we just created. We can check that directly from GitHub:

From now on whenever we want to save the changes we make we can go to the Changes section in Team Explorer:

And in the Synchronize section confirm the output changes:

PART 2: Continuous deployment between Azure Web App and GitHub repository

As a first point it is necessary to have a Web App service in Azure, for this we can create it from the Azure portal in case we do not have an established application.

As we can see in the image, the name of the application will also be used to define the domain name in order to access the website that you want to create. Azure provides us with a subdomain with azurewebsites.net.

Also, Azure allows us to specify the execution stack, in this case we select .NET Core 2.2 which is the version that our application uses.

Alt Text

The creation of this service usually takes between 30 and 60 seconds.

Now that we have the service created, we are going to the resource in the Azure portal. On the application page, select Deployment Center from the menu on the left.

On the implementation center page, we select GitHub and then log in and select Authorize.

As for GitHub, on the page to compile the provider, select App Service build service and then Continue.

Then on the configuration page:

We display the menu and select the organization, the repository and the branch that you want to implement continuously.

After setting up the compilation provider, review the settings on the summary page and select Finish.

From now on the new confirmations of the selected repository and branch are now continuously implemented in your App Service application. You can track confirmations and implementations on the implementation center page.

ADDITIONAL COMMENTS

** Disabling continuous deployment**

To disable continuous deployment, select Disconnect at the top of the Deployment Center page of the application.

To continue with the continuous implementation later, we repeat the association process to the GitHub repository from the Deployment Center page of the application.

Other sources of repositories

In addition to GitHub, with Azure Web App we can also carry out continuous deployment from the following sources:

• Bitbucket
• Local Git
• OneDrive
• Dropbox
• External
• FTP

Top comments (0)