Quantcast
Channel: sandrino.dev
Viewing all articles
Browse latest Browse all 77

Continuous Deployment with Windows Azure Websites and Bitbucket

$
0
0

A little over a month ago Scott Guthrie announced support for continuous deployment in Windows Azure Web Sites with GitHub and CodePlex. Yesterday while I was browsing the azure tag on StackOverflow, I noticed a very interesting answer by David Ebbo:

Update (10/27/2012): as it turns out, the Bitbucket support for public git repros just became available today, so give it a try!


Currently this is only supported for Github and Codeplex, but the Bitbucket support is around the corner. Initially, it will only support public repos, but the private repo support won’t be too far behind. Can’t give exact dates, but normally it should all happen before the end of the year.

Let’s see how easy it is to set up continuous deployment in your Windows Azure Web Site with Bitbucket.

Setup

First we’ll start by setting up our Bitbucket repository. At the moment only public repositories are supported, but as you can see in David’s answer, private repositories are on the roadmap. I’m going to create a new repository called SampleAzureWebSite, choose Git as repository type and set the language to C#.

Create repository on Bitbucket

That’s it for the Bitbucket part! Now, in the Windows Azure Portal I’ve created a new Web Site called Bitbucketwebsite and I’m going to set up Git publishing (you can find the option under quick glance):

Bitbucket Windows Azure Web Site

If you’re familiar with the Git publishing screen you’ll see a new option available here: Deploy from my Bitbucket repository

Deploy from my Bitbucket repository

By clicking the Authorize Windows Azure link you’ll grant access to your public and private repositories.

Authorize

After granting access, Windows Azure will be able to show your repositories (only the public ones at the moment) in the portal. Select the repository you want to link to your Web Site:

Select repository

That’s it, your repository has been linked to your Windows Azure Web Site!

Bitbucket repository linked

Our first commit

Now that everything has been setup we can start doing some actual work. I’ve created a new ASP.NET MVC4 project and saved it under D:\Repositories\Bitbucket\SampleAzureWebSite. This will be the root of my repository. I’ve only made a small change in the HomeController:

And now I’m ready to commit (I’m using Git Bash for this). I’m simply going to initialize the repository, add all items in the local repository and commit/push all changes:

This push will trigger the continuous deployment process in Windows Azure. Go back to the Windows Azure Portal, open your Web Site and navigate to the Deployments tab. You’ll see that your changes have been picked up (notice the Initial commit comment) which triggered a build and publish to your Web Site:

Initial commit

That’s it! Now, each time it push something to my repository I’ll see the change on http://Bitbucketwebsite.azurewebsites.net

Again a job well done by the Windows Azure team to make deployments a walk in the park!


Viewing all articles
Browse latest Browse all 77

Trending Articles