Automating code deployment with GitHub and Azure

Image of Allen Smith

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.

Your 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.

Choose a repository and branch

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.

Your Repository is Linked

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.

Merge a Pull Request

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

Join us at GitHub Universe

Our largest product and community conference is returning to the Palace of Fine Arts in San Francisco, November 13-14. Hear what's next for the GitHub platform, find inspiration for your next project, and connect with developers who are changing the world.

Get tickets

GitHub Actions now supports CI/CD

GitHub Actions makes it easier to automate how you build, test, and deploy your projects on any platform, including Linux, macOS, and Windows. Try out the beta before GitHub Actions is generally available on November 13.

Sign up for the beta