There are many cloud services that support automated code deployment from GitHub. In this post, we're going to be taking a look at connecting a GitHub repository to a Microsoft Azure instance. When working with continuously delivered projects like web apps, this connection can be especially helpful for pushing out things like critical bug fixes; but it also removes barriers that might be keeping new features in a holding pattern on stale branches.
And you can set everything up in under 10 minutes.
Prerequisites
You'll need a running web app instance on Azure before you get started. If you need help setting one up, there are quick video tutorials available in the Azure App Service documentation.
When your app is running, browse to its dashboard.
Step 1: Connect your App to its Repository on GitHub
In the All Settings menu on the right, choose the option to set up Continuous Deployment. Then click the Choose Source blade and choose GitHub.
GitHub may ask if you want to authorize Azure to have access to your accounts. It's safe to click Authorize application.
Once authenticated, Azure will ask you which repository and which branch to deploy to your app.
Select your GitHub repository from the list and make sure you are deploying the master
branch. Then click OK to finish up.
Azure will show you that your repository has been linked and will automatically begin deploying your code to your site.
When you see the green Active Deployment status, you're all set.
Step 2: There is no Step 2
That's it. If you browse to your app's URL, you'll see your app is now live on the Internet.
With everything connected, GitHub notifies Azure of any changes to the branch you specify (usually master
) and Azure automatically deploys them for you. This means anytime you merge a Pull Request into master
on GitHub, a single click delivers all of that new work to the people who use your app.
If you use Microsoft Azure to serve your app, this setup not only makes it easy to push out things like bug fixes; it also stimulates new development by removing barriers and helping you focus on shipping great code.
Additional Resources
- A full video walkthrough of setting up an Azure app connected to GitHub is available on the GitHubGuides YouTube channel.
- Likewise, this Microsoft Azure documentation article provides additional detail about deploying different types of projects, such as Visual Studio Solutions.