Automating Code Deployment With Azure And GitHub

Azure

Hello, new Azure users in another hand-on guide on how to work with Azure in order to deploy your applications. In this article, you will come to know how to use ‘App Services’ and exploit GitHub’s source code management functionalities and version control in order to automate the deployment of your software and maintain the record of prior changes in order to mitigate the extra efforts in pushing to production.

Of course, basic Git knowledge is preferred although not required (This article is not about working with GitHub); for more about Git, you can find a guide here. In this demo, I will be deploying a sample Django project as in a ‘production scenario’. For more about Django framework, visit this URL.

Azure

Login and creation of Web App service instance

Log in to the Azure dashboard from the Azure portal.

Azure

Visit the ‘App Services’ category from the left.

Azure

You will be redirected to your "App Services" page where all of your previously created applications will be located (if you have any). Then, choose ‘Create App Services’.

Azure

From the window which will appear, click on the type of instance you will deploy. For this demo, I will keep it simple by choosing a Web App type, for instance - with no database.

Azure

Then, choose "Create".

Azure

From the next window, choose a unique name (because it will be an Azure subdomain and it needs to be not already taken), choose your subscription (for payment), and choose a resource group (you can create a new group if needed). You can select the pin to dashboard option if you want to easily find your project whenever visiting the dashboard.

Then, hit ‘Create’.

Azure

After that, you will receive notifications about the status of the newly created application, after being redirected to the dashboard.

Azure

Congrats !! Now, your instance is deployed !!

Deployment from GitHub – deployment automation

After creating the instance, we need to choose a deployment source. In our case, we will pick out GitHub as we will be deploying a project from a GitHub repository … For more information concerning the creation of repositories and deployment/management of projects using Microsoft Visual Studio Code, you can read this article - MS Visual Studio Code – Guide To Git.

Now, we have to visit our instance management page and select the ‘Deployment options’ option.

Azure

You have to select GitHub as a ‘Source’ as a required setting.

Azure

After authenticating your identity (by authorizing access to your GitHub repositories), make sure that the branch set to deployment is the master branch, then click "OK".

Azure

Now, your changes must be getting applied, and this must lead to a success.

Azure

Azure

Now, your instance should be executed and running, using software from your GitHub repository with changes automatically being applied to each deployed version in your master branch.

I hope you found this useful. As always, feel free to comment any related questions.

Next Recommended Readings