Sep 12, 2016
Integrate your source control from Github to Azure.
Nowadays, when we are developing web applications, we tend to use repositories such as those provided by GitHub. When using these repositories, our source code is being controlled by GitHub, which means it is safe and we have versioning on it. But, after you have committed your code to GitHub it still hasn’t been published to the server (in our case Azure) to be hosted as a live site.
To deploy your site to a live version you can either do it manually in a variety of ways or set up your Azure web app to pull it from a GitHub branch automatically. By doing this you are integrating your source control into your Azure platform, this has support for multiple providers that can store source code; such as DropBox, BitBucket, CodePlex and a few more.
To perform this with GitHub we need to check that we have the necessary branches in our repository, as we would be assigning one of these to act as the branch to be automatically published.
In my case, I have a Development branch and a Release Branch. The Release branch will be used for the auto publishing and the Development Branch is used for coding.
To be able to use this integration of source control we need to make sure we have a Web App in our Windows Azure environment. In this case we are using a newly created web app called ‘auretautodemo’.
After we have created the web app or selected the web app of interest to use we can use Integrate source control option to set up the auto publishing functionality (as outlined in the image).
Once you select this option, you have a wizard to run through that will ask the following.
- Where is your source control? – This is the provider where your source code is stored, in our case it will be GitHub.
- It will then ask for authentication to the provider – This is the login details to your account on the selected provider.
- When using GitHub you have to choose the Repository and the branch of deployment. – In our case we will select the ‘auretautodemo’ repository and the ‘Release’ Branch.
After these steps you will see a screen with deployment summaries, this screen will show you all the deployments that went through. It will pull the current commit and anytime you commit code to the Release branch it will automatically publish it to the Azure web app.
In my scenario, I made a change to the index page and made a commit into the Release branch to reflect the new changes. When this commit goes through, Azure will pull the commit and perform the deployment for you.
For more information, take a look at New Horizons' Microsoft Azure training courses.