Continuous Deployment in Windows Azure Web Sites

Automation of tasks is one thing that I am an advocate of in my development projects. Getting functionality that is repeatable with a low risk of human error for a one time cost is a sound business decision and as a developer, keeps your hands on rolling more code for a greater percentage of your work day. It’s a Win-Win scenario.

The Windows Azure Web Sites team along side the Kudu team have added Continuous Deployment functionality in Windows Azure Web Sites with support for three familiar social source code repositories: CodePlex, GitHub and BitBucket. The team has also added support for Contiguous Integration using Team Foundation Service [a new Cloud Based offering of Team Foundation Server].

Windows Azure Web Sites now allows Continuous Deployment from Private Repositories from both GitHub and BitBucket.

In this post:

  1. Create a Windows Azure Web Site
    1. Enable Git Deployment
  2. Associate a Source Code Repository
    1. Associate a GitHub Repository to Windows Azure Web Sites
    2. Associate a BitBucket Repository to Windows Azure Web Sites

Create a Windows Azure Web Site

To avoid reinventing the wheel, you can follow instructions outlined on the Windows Azure Develop Center on how to Create a Windows Azure Web Site and Enable Git Deployment.

NOTE: If you do not need a MySQL database, or have decided to go with another database option, choose Quick Create from the Web Site menu instead of Create with Database.

Associate a Source Code Repository

In order to facilitate the Continuous Deployment it’s necessary to have a centralized location to pull the website code from, in this particular blog entry we’re going to use GitHub and BitBucket.

Initializing a Git Repository will redirect the Management Portal to the DEPLOYMENTS tab.

Now that Git has been enabled use the collapsible menus to select how you would like to deploy code to the new Windows Azure Web Site.

Associate a GitHub Repository to Windows Azure Web Sites

GitHub-Deployment-Accordion

Expand the item labeled Deploy from my GitHub repository.

GitHub-Deployment-Steps

Click on Authorize Windows Azure. This will open a window to federate with GitHub, you will need to approve the ability for Windows Azure to access your GitHub account.

GitHub-Authentication

Once access has been granted, the browser will redirected back to the Management Portal to a screen to select either a Public or Private repository.

GitHub-Select-Repository

After selecting the repository to be published, click on the check mark to start the deployment process.

If your repository is empty, push to GitHub to trigger deployment to Windows Azure.

GitHub-First-Deployment

Each subsequent push to GitHub will trigger a service hook and begin a deployment of the latest bits to the Web Site. Now that the deployment has been pulled into the Web Site, clicking on Browse in the Taskbar Drawer will launch the web application.

GitHub-Published-Custom-WordPress-Site

Associate a BitBucket Repository to Windows Azure Web Sites

BitBucket-Deployment-Accordion

Just like associating a GitHub account to a Windows Azure Web Site, expand the Deploy from my BitBucket repository. Authorize Windows Azure to access a BitBucket account by federating authentication through BitBucket.

BitBucket-Deployment-Steps

After clicking on Authorize Windows Azure, a prompt to authenticate with BitBucket.

BitBucket-Authentication

After signing into BitBucket a prompt to select the Public or Private repository to deploy to Windows Azure Web Sites.

BitBucket-Select-Repository

Unlike GitHub, BitBucket will require you push a change to the repository before the Service Hook will deploy code to the Windows Azure Web Site.

image

Once a push has been made to the private BitBucket repository, the deployment will be pushed to the Web Site.

image

In the taskbar drawer at the bottom of the browser viewport, click the Browse Button.

image

A new window will open and the site will display the web files which were pulled into the Web Site.

Conclusion

Continuous Deployment is a great way to introduce new features or functionality to your customers in an automated fashion. With the new support for Private Repositories, Windows Azure Web Sites can help delivery stunning web sites which utilize either open source projects from public repositories, or provide clients with a customized solution from a private repository.

Stay Cloud my Friends…

Windows Azure Training Kit – October 2012

The moment that you’ve all been waiting for has come, the October 2012 drop of the Windows Azure Training Kit has been released! This release is rather significant and I’ll get into the details in a few minutes, but first I wanted to call out the Windows Azure Training Kit page on WindowsAzure.com.

Special Thanks to the WindowsAzure.com team for updating the Windows Azure Training Kit page.

image

What’s new in this Release?

The October 2012 update of the Windows Azure Training Kit includes 47 hands-on labs, 24 demos and 38 presentations designed to help you learn how to build applications that use Windows Azure services. The October update includes updated hands-on labs to use the latest version of Visual Studio 2012 and Windows 8, new demos and presentations.

Presentations

We received a lot of requests to add speaker notes in the slide presentations. I’m happy to announce that we have included speaker notes necessary to support the majority of sessions in the Agendas which are outlined on the Agendas section. The following presentations have speaker notes to aid you in delivering a session:

Foundation

DevCamps

Localized Content

We have scene how excited the community was about mobile services, so we have created new GitHub organizations to host localized versions of the Mobile Services Presentation.

Hands-on Labs

September marked the launch of Visual Studio 2012 RTM. How do we ring in this celebration? We’ve converted a number of Hands-on Labs to support Visual Studio 2012. In addition to this, we wanted to ensure that you were properly supported for running community events, so we have ensured that the Hands-on Labs will work with Visual Studio 2012 Express Editions just incase you or your audience do not have a license.

Labs available for use with Visual Studio 2012

New Labs page Layout

As the number of labs has increased, we wanted to provide a nice simple way of discovering the provided hands-on labs. The page is divided now into VS2012, VS2010, Open Source, Scenario, and All [which is the classic layout with the ability to Navigate by Service.]

Windows Azure Training Kit Hands-on Labs

Demos

You may not have noticed in the August 2012 REFRESH but we shipped a few demos. You might not have noticed this because we didn’t have a navigation page for you to browse them, they were just sitting around on your hard drive if you were adventurous enough to check.

We’ve added a landing page now which will help you navigate and discover the demos which we have packaged for use with the presentations.

image

Available Demos

Contribute

GitHub - Codercat

One of the nicest things about the Windows Azure Training Kit is that it is open source and available on GitHub. This enables you in the community to Report Issues or Fork and either extend the solution or commit bug fixes back to the Training Kit.

You can find out more details about  the training kit from our GitHub Page including guidelines on how to commit back to the project.

Happy Clouding!

Update Released: Windows Azure Storage Plugin for WordPress

Microsoft Open Technologies, Inc. announced today that they have released an update to the existing WordPress Plug-in, Windows Azure Storage for WordPress.

If you aren’t familiar with the tool, essentially it allows you to sign up for Windows Azure, create a storage account and save your blog post assets like images, videos and documents in a durable, CDN enabled [enabling CDN in Windows Azure Storage] storage system with up to 100TB of storage!

Why Update the WordPress Plug-in?

The major reason for the update was to bring the tool inline with the most recent release of the Windows Azure SDK for PHP [Windows Azure SDK for PHP on GitHub]. For this reason alone, it is a great example of a real world application which reaches thousands of users [Current Downloads as of this post: 2635].

Need Installation Instructions? Read Windows Azure Storage Plug-in for WordPress Updated by Brian Swan.
Need a Blog? Sign up for a Free Windows Azure Account, then Setup a new WordPress Blog on Windows Azure Web Sites using the OSS Gallery.

If you use WordPress as your blog engine or as a CMS, the Windows Azure Storage for WordPress Plug-in is definitely worth a look.

How does the Plug-in Work?

More interested in the Architecture of the Plugin? Read Windows Azure Storage Plug-in for WordPress by Doug Mahugh

The plug-in uses the WordPress Filters to inject new storage functionality such as a tab for accessing existing items in the storage container, a mechanism for saving content to Windows Azure Storage, as well as providing XML-RPC support for saving attachments from third party blog tools (like Windows Live Writer).

Under the covers the tool saves your media files as Block Blobs, it utilizes the BlobRestProxy exposed by the Windows Azure SDK for PHP to commit the files in individual blocks (max. 4mb in size) before committing the entire blob. The benefit to using this technique is if any one (or multiple) block doesn’t succeed in uploading, the maximum amount of data that needs to be resent to Blob Storage is reduced (which in turn saves in bandwidth usage).

All thumbnails which are auto-generated by WordPress are uploaded in the same fashion, then the metadata (Container Name, Blob Name, Thumbnail urls) are all saved to the database using add_post_meta.

Can I Contribute?

If you want to add additional features, or view the Source code for the Windows Azure Storage for WordPress Plugin it is available from the WordPress Plug-ins SVN Repository under a New BSD License.

More into Git? [Me too…] Instructions for Bidirectional operations between SVN and GIT

Once you’ve downloaded the source, you may want to consider checking out WebMatrix which has support for PHP syntax highlighting and code completion, as well as WordPress specific code completion which will be helpful when you’re extending the plug-in.

Happy Blogging!