Tue, Nov 6, 2012

Publishing to Windows Azure from Github

Back in July 2012 Microsoft announced improvements to Azure Web Sites. One of those improvements was to Git publishing so when you pushed changes to your Github repository Azure would automatically pick that up and deploy the project. I even mentioned it in my DinnerParty blog post but have only just looked at implementing it.

Preparation

As I said in my previous post Azure supported Git publishing but it was a two step process. You push to Github and then push to Azure and it gets deployed. If you already have Git setup on your Azure account there is nowhere in the dashboard that allows to you setup Github integration. I thought I was going to have reset my deployment credentials and set it all up again when I asked the question on Jabbr. Luckily David Fowler was online. Why is that lucky? He wrote the Github integration feature of Azure.

To setup your Azure account to enable Github integration you have to FTP into your Azure account and delete the deployment history by deleting all contents in the /site/deployments folder.

Deployment History

Deployment History

Setup

Once the history is deleted, if you go to the Deployments tab in the Azure account you will now see a link to “Deploy from my GitHub repository”.

Setup

Setup

By clicking the link it will inform you that you need to authorize Azure to have access to your Github repository and that if there is code already in your repository it will be deployed again.

Authorize

Authorize

Once you authorize Azure to read your Github account you need to tell it which repository it should watch.

Repository

Repository

As stated earlier, if there is code in the repo it will begin to deploy automatically and confirm deployment once this has been done.

Deploying

Deploying

Deployed

Deployed

From now on, once you push changes to your Github repository Azure will pick them up and deploy the project to your web site! Could it get any easier?

UPDATE 7th Nov 2012: After speaking to David Fowler again he remembered that you could take the Git webservice hook and enter that into the Github repository account settings.

Go to the Configure tab in Azure and copy the Git hoook URL.

Azure Hook

Azure Hook

Then go to your Github repo and into the Admin section and under Service Hooks enter the copied Azure URL

Github Hook

Github Hook

Away you go!

comments powered by Disqus