Archives by Graham Smith

Continuous Delivery with TFS: Laying the Azure Foundations

Posted by Graham Smith on December 2, 20142 Comments (click here to comment)

For anyone interested in creating a continuous delivery pipeline with TFS this is the first article in a series of posts that will explain how I created my demo pipeline. I've used Azure IaaS (ie virtual machines configured with specific roles such as IIS) however if that's not an option for you then it should be easy to translate everything to your way of working -- virtualisation, actual physical servers etc. I won't be going in to very much detail about using Azure so if you are new to Azure see one of my previous posts here for details of how to get started, and make sure you are familiar with its IaaS capabilities, ie how to create and remote desktop to VMs.

Many technologies have both a quick-and-dirty way of doing things and also a more considered way. Azure is no exception and if you don't make any alternative arrangements creating a new virtual machine in Azure will create a new storage account and a new cloud service. Things can quickly get out of hand and you end up with stuff all over the place and the possibility of using credits faster than you intended. To keep things tidy it's best to create some foundations upon which you can create your VMs. Buck Woody has a great post here which explains the steps and is mostly still relevant even though the post dates back to April 2013. I'm not going to repeat the detail of the post here but this is a summary of what you need to set up:

  • Affinity Group -- keeps a set of resources together which can help to minimise costs. Choose a region that makes sense for all of the VMs you will create.
  • Virtual Network -- allows all of the VMs to talk to each other. At the time of Buck Woody's post it was possible to specify an Affinity Group for a Virtual Network but this has now changed and you can only specify a region. You can read more about this here, but when you create your network choose the same region as the Affinity Group.
  • Storage Account and Container -- this is where the VHDs of your VMs are stored. Choose the Affinity Group you created previously. When your Storage Account is running create a Container called vhds.
  • Cloud Service -- this is the container in which all of your VMs will live. You can create a new Cloud Service at the same time as creating a new VM but I prefer to create one up front, specifying the previously created Affinity Group.

In the spirit of keeping things neat and tidy when I create a new set of the above resources I like to use a naming convention which consists of a short prefix plus the name of the resource I'm creating, eg AlmAffinityGroup, AlmVirtualNetwork and so on. Bear in mind that some of the names -- in particular the Cloud Service -- need to be globally unique so it's worth navigating to the first page of the Cloud Service wizard (which will validate names you put in) to find something that is likely to work before you start in earnest.

Once all the above are in place it's worth creating a test VM -- it's simple to delete it once you have finished testing. I tend to create my VMs with PowerShell and will post about this in the future, but for the meantime in the Portal you can choose New > Compute > Virtual Machine > From Gallery. Choose Windows Server 2012 R2 Datacenter (or whatever might have superseded this) and move on to the next step of the wizard. I always use the latest version, and choose the basic tier as it's cheaper, and for a test VM choose an A0 size, again to keep costs down. Supply a name for the VM and a username and strong password and then at the next step in the wizard you can supply all the resources you created above.

On the subject of keeping costs down it's worth noting that to ensure you don't get charged when you are not using your VMs you have to actually shut them down from the portal or use the Stop-AzureVM PowerShell cmdlet so that their status is Stopped (Deallocated). Simply powering off from within the VM isn't enough. Automating this is the way forward -- another future post!

Cheers -- Graham

Getting Started with Microsoft Azure

Posted by Graham Smith on November 30, 2014No Comments (click here to comment)

Back in the olden days when I wanted to use my MSDN subscription to learn a new technology such as SQL Server I pressed an old PC in to service to act as the host. Several years on and virtualisation had become commonplace and this allowed me to run several hosts using Hyper-V on an always-on beefier box located in my home datacentre under the stairs. With the arrival of Microsoft Azure all that tin is now a thing of the past and anyone using Azure has an extraordinary wealth of computing power and flexibility at their disposal. (There are other cloud providers of course but I find it’s enough of a job keeping up with the latest offerings from Azure, never mind what Google or Amazon might be churning out.)

For anyone new to Azure, where to start? If you already have an MSDN subscription then the great news is that you already have free monthly credits, and this page has more details. If you don’t have MSDN then other options include taking advantage of the Azure one-month free trial or maybe even paying for Azure yourself. This isn’t as crazy as it sounds since you only pay for what you use and services such as virtual machines can be shut down when they are not being used so you won’t get charged.

So you have your subscription set up, now what about learning Azure? There are numerous free resources you can take advantage of (including lots of videos if that’s your thing) and below I’ve listed what I consider to be the most useful at the time of writing this post. In particular, this video from Scott Guthrie is a great way to get a broad overview of what Azure offers.

Microsoft Azure is evolving so rapidly that once you have learned the basics you need a strategy for keeping abreast of what’s new. For me this is a combination of The Azure Podcast as listed above and a variety of blogs. Scott Guthrie’s blog is particularly noteworthy, but if you are a .NET developer you are hopefully already following it.

Cheers – Graham

Creating a Continuous Delivery Pipeline from Scratch using the TFS Ecosystem

Posted by Graham Smith on November 28, 2014No Comments (click here to comment)

For anyone working with the Team Foundation Server ecosystem there are plenty of articles on how to get started with the individual components – TFS itself, Visual Studio, Release Management, Microsoft Test Manager and so on. Frustratingly though there is very little guidance on how to piece everything together to create continuous delivery pipelines that build code, automatically deploy it to an environment and then run automated acceptance tests.

Until now that is, because over the next few months I’m going to document my experience of building a continuous delivery pipeline – in my case using IaaS in Microsoft Azure. As each post is written I’ll update my Continuous Delivery with TFS page which will serve as a handy reference for anyone wanting to work through the process. If you are interested in knowing more about the philosophy about continuous delivery then have a look at this article and also this one. Both of these refer to the Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation book which is the current authoritative text on this subject and which I definitely recommend anyone working in this area should read.

Cheers – Graham