Update your Azure infrastructure as part of a build

In this post I demonstrate how you can create and update your Azure infrastructure as part of a build in Visual Studio Online (VSO).  This enable to deliver and test your code and your infrastructure continuously. 

Under your VSO project, choose build, and right click your build and choose “edit”, add an Azure Resource Group Deployment.

To be able to provision the infrastructure from your VSO build your Resource Group Deployment need to receive the permission to be modify infrastructure in your Azure subscription.  Therefore you can use a Service Principal.  This msdn article details how you can create a service principal inside your subscription and use it inside your deployment.

Watch out: if you’ve several subscriptions, chances are that you run under the wrong subscription, this will result in the following error: “The provided information does not map to an AD object id”.
You’ll need to select the proper subscription, just after the step: “Add Azure Account” use the following command: Select-AzureSubscription -SubscriptionId <subscription-id>

The remaining steps are obvious.

Select your Azure Subscription, provide a name to your resource group, select the ARM template inside your VS solution and the parameter file you want to use for this deployment.

Now you can include this step inside your continuous integration build or create a specific build for your infrastructure setup that you can trigger at will. 

How To: Use Azure Resource Manager in Visual Studio for creating Web Apps

Here we want to create our Azure Web App from within visual studio.  The goal is to be able to recreate the infrastructure at will and host a web app on it.  We do this by including an Azure Resource Group project inside our solution. This bundle the code of our website with the definition of the infrastructure that is needed to host the website. The Azure Resource Group project contains the description of your infrastructure inside an ARM(Azure Resource Manager) template and one or many parameter files. With this project you make sure that your configurations can be consistently repeated, tested, shared and promoted across different environments. This concept is called “infrastructure as code”.

First we need to add an Azure Resource Group project to our visual studio solution.

Right-click Add, new project.

If you didn’t have downloaded the Azure SDK, you first need to install it.

Choose “Get Microsoft Azure SDK for .Net” from the Cloud category and complete the installation steps.

Once the Azure SDK installed, reload your solution, right click on your solution, add, new project and select Cloud, “Azure Resource Group”, provide a name to your project and click OK.

Here we’ll setup a simple website.


Then we’ll need to fill in the parameters.  You can do this via the deploy wizard or directly inside the “Website.param.dev.json” file. The file is located under your ARM project in the folder Templates.

The siteName and hostingPlanName are up to you, you can fill in what you like or provide the name of an existing one.  For siteLocation you’ve to choose between one of the Azure datacenter regions, you find the list under: https://azure.microsoft.com/en-gb/regions/

Just Copy the name of the region that is appropriate to you.


Right click your ARM project and choose Deploy, New Deployment.

 Click on Deploy


Once completed you should see the newly created website in the portal.


Now you can publish your web app through Visual Studio.

Right Click your web project, choose publish and select “Microsoft Azure Web App”.

Setup, develop and deploy your ASP.NET MVC Umbraco website on Azure


To run Umbraco on Azure you can choose to use the build in Azure template.



For simple websites this could do the job but if you want to extend the portal with your own code or if you want to version control your site you’re better of starting with a blank MVC website.


Umbraco development lifecycle

Managing the lifecycle of an Umbraco application is somewhat challenging as Umbraco is one platform made out of several components (code/DB/content) and it’s not always clear what you need to deploy to promote content or features.  Especially deploying database changes can be cumbersome.  I personally chooses to avoid to have to stage DB changes by running all my environments (local/integration/production…) on a single DB hosted on Azure.

Because Umbraco already has a notion of staging you can for most cases work safely on the production database from your local machine without fearing to impact production.   Nevertheless when I need to make risky changes to my application or when I need to test a major Umbraco upgrade then I setup a clone of my production DB and do the development and testing on the clone.

For most of the changes my development cycle goes as follow:

  1. All my changes are made locally through the local umbraco portal (running on my local machine) or for Extensions through Visual Studio.
  2. When new content is added to the site I make sure these are included in my local Visual Studio project.
  3. I make sure that everything run nice locally.
  4. I check-in all the changes
  5. Publish the changes to Azure through the publish wizard.
  6. Test that everything runs fine in production.
  7. Promote the content once everything is tested

Umbraco first deployment

In this part I explain the steps to take to deploy the skeleton of an empty ASP.NET MVC Umbraco website.

Through the Azure portal:

  • Create a SQL server DB, don’t forget to note your password!
  • Create a new web app

Open VS: Start new project, Web, Asp.Net web application

Manage Nuget packages, umbracoCms




Click RUN in VisualStudio and launch the website locally.

Enter you Name, email & password and click Customize.

As Database type choose Microsoft SQL Azure.

You can find your connection details from the Azure portal (via old portal): select your DB, dashboard, Show Connection strings.
Use the ADO.NET connectionstring, copy each relevant part in the textboxes, for the server you need to provide the “server” part but without the leading “tcp”.
Click next.

Before publishing your website to Azure you first need to include files/folders to your project:

  • App_browsers
  • App_Plugins
  • umbraco
  • umbraco_client
  • config\splashes
  • css
  • js
  • media
  • scripts
    If you used a template also include the cshtml files under the Views folder.



Also set the build actions of the following web.config files to “none”.

– \umbraco\install\web.config

– \umbraco\Xslt\Web.config



Now publish the website: right-click your web project, choose publish.
Select your Azure Web App, the connectionstring should be retrieved by VS from your project.


If you followed everything in the exact order you should see your website running on Azure!

Learning Kodu links

Here a couple of links in dutch, french and English with info on how to learn Kodu to kids:

In het Nederlands:



Les1: Basis


Les2: Uitgebreid


Les3: Vijand


Les4: Padden


Les5 : Race Game


Getting started with Kodu Game Lab


Tutorial pdf:



Basics :


Football :


Racing Game :


Kodu en français

Installer : http://jdolle.simdif.com/programmation_jeux.html

Initiation :



Leçon 1:


Partie2 :


Partie3 :


Learning Arduino for beginners

Through this link you can download my course for Arduino beginners. This course is one of the many I use to entertain kids during our coding-dojos sessions.  Yesterday it was the first time in Brussels we gave an Arduino session. We got kids going from 10 to 14 years. The session was a success. Despite the fact that none of them had any electronic or c-like programming background most of them managed to build one or several projects and present it to their colleagues.

Each project is intended to be built in two steps.  First the students can simply follow the schematic and can copy/paste the code they’ll find by following the provided link.  Then they need to complete a simple assignment consisting in extending what they build in the first step.  To complete the second step they need to make simple changes on the board and in the code.  Hints are provided to help them, so no real coding or electronic know-how is required.

The first project is simply making a led blink, the students should all start with this one.  Once the first assignment done they can choose between three different projects: a love-o-meter, music instrument and a lazer-tag.

Download link

Learning programming with Scratch


Here is a little coding exercise inspired from one of the codeingame puzzels. It was ported based on the Mars Lander-2 game made by mrswanson.  This game is primarily targeted as a coding exercise for kids/students to learn programming.

Your mission: reprogram the mars lander.

In fact the problems concerns the landing phase for “Mars Lander”, the landing ship which contains the Opportunity rover. Mars Lander is guided by a program, and right now the failure rate for landing on the NASA simulator is unacceptable.

Built as a game, the simulator puts Mars Lander on a limited zone of Mars sky. The zone is 138m wide, the center of his position is at position “LanderX”. The ship can get into the zone at a variable location but may not crash on the mountains.

Your mission is to write a new artificial intelligence program that will enable Mars Lander to land safely on Mars without crashing. The program will have to go through a series of increasingly complex simulator tests.

You’ll find the Mars Lander program under:


– You should add your code inside the lander forever loop.
Click on the lander sprite, in the “Scripts” tab you should see:


– To drive the lander you should broadcast “left”, “right” or “up” messages.


For a landing to be successful, the ship must:

– land inside the flat ground, the center of the landing path is at horizontal coordinate 0 (when  x = 0).  (=LanderX)

– vertical speed (=ymotion) must be limited ( ≤ 1 m/s).

– horizontal speed (=xmotion) must be limited ( ≤ 1 m/s).


Have fun!


Wouldn’t it be great if I ‘had a central place where I could keep and work on all my little nuggets of utility code I’ve written over the years. Also be able to download them from nuget would be very convenient. This is why I’ve decided to setup a new project on Github. There I just posted the first library of my personal Swiss army knife framework.

These libraries where primarily designed to build loosely-coupled applications where you can swap out particular components without affecting the rest of the application. Most of my libraries are just small layers above existing frameworks providing a common API that simplify their usage (for me at least). The libraries ease the use of these frameworks by providing standard configurations and exposing only the functionalities I found useful for me through what I saw as a “common API”.

The first library I uploaded is: Go.Simple.Logging

GoSimple.Logging is a small and simple library that provides a common interface for logging. It comes together with an implementation for Log4Net: GoSimple.Logging.Log4Net.

It provides a simple logging interface (Logger.Debug(..), Logger.info(..), Logger.warn(…), Logger.Error(…),….).  I use this nuget package in all my projects to easily integrate with Log4Netwithout having to remember how to configuer & setup Log4Net.

The library comes with an appender to send the logs through syslog to a Splunk server. The TcpSyslogAppender you’ll find in the Log4Net implementation was extensively tested and fine-tuned on many large scale applications running in production.

You can download it through nugget by using the nugget console:

Install-Package GoSimple.Logging.Log4Net

The most valuable extensions you’ll find in this project are:

  • Syslog Appender: used to send your logs over TCP or UDP to a syslog server like Splunk, Logstach or Kiwi.
  • Rolling File Appender: when GoSimple rolls a log file, it saves and closes the old file and starts a new file.

GoSimple.Logging comes with a sample project, you’ll find it on the github project home. It provides an example of how to configure your application for GoSimple.Logging in just one line of code. You’ll also find a sample Log4Net config file with example config sections for each appender.

To enable it on your project you need to :

  • 1) Review the Log4Net.config file on the application root.
  • 2) In VS set the property “Copy to output directory” of the Log4Net.config file to “Copy always”
  • 3) In your application entry point (bootstrapper/main) initialize the Logger:
    Logger.Initialize(new Log4NetLogger());

Voilà that’s all you need to configure to enable logging in your application.

How to get the powershell version

To print out the current Powershell version you can use the $PSVersionTable variable that was introduced since Powershell version 2.


Quality saves time and money!

In software projects quality saves time and money!.   

This principle is based on the observation that one of the most time consuming activity is rework. The rework arises from changes in requirements, change in design, or debugging. The single biggest activity of building software is debugging and correcting code that doesn’t work properly. Following my experience this activity account for about half of the time spent on development. Think at what you really do when you code, generally the time spent in writing production code is ridiculous compared to the time spent at debugging, fixing infrastructure issues, reading code, fixing bugs…

Therefore, the most obvious method to reduce our development cost is to improve the quality of the product and decrease the amount of time spent debugging and reworking our software. This analysis is confirmed by external field data. In a review of 50 development projects involving over 400 work-years of effort and almost 3 million lines of code, a study at NASA's Software Engineering Laboratory found that increased quality assurance was associated with decreased error rate but did not increase overall development cost. Statistical analysis conducted at IBM found that software projects with the lowest levels of defects had the shortest development schedules and the highest development productivity. They explained their findings by staying that software defect removal is actually the most expensive and time-consuming form of work for software (Jones, Capers 2000: “Software Assessments, Benchmarks, and Best Practices.” Addison-Wesley).

Because the duration at which a software defect stays in a program is directly correlated with the cost of fixing it, quality practices should focus on solutions that enable to remove and/or detect errors as soon as possible in each stage of the project lifecycle. Indeed other studies have proven that one of the most important cost factors is the time in which errors are found. The longer the defect stays in the software production chain, the more damage it causes further down the chain. Since requirements are done first, requirements defects have the potential to be in the system longer and to be more expensive. Defects inserted into the software upstream also tend to have broader effects than those inserted further downstream.

Average Cost of Fixing Defects Based on When They're Introduced and Detected

Time Detected 

Time Introduced 




System Test





















Based on book “Code Complete” and studies* -> Fagan 1976; Leffingwell 1997; Willis et al. 1998; Grady 1999; Shull et al. 2002; Boehm and Turner 2004.

The bowling game Kata

Here is a kata made by uncle Bob (Robert C. Martin).  It should be resolved the TDD way (you know…by writing the test first).  The user story of the kata sounds like:
“The game consists of 10 frames as shown above. In each frame the player has two opportunities to knock down 10 pins. The score for the frame is the total number of pins knocked down, plus bonuses for strikes and spares.

A spare is when the player knocks down all 10 pins in two tries. The bonus for that frame is the number of pins knocked down by the next roll. So in frame 3 above, the score is 10 (the total number knocked down) plus a bonus of 5 (the number of pins knocked down on the next roll.)
A strike is when the player knocks down all 10 pins on his first try. The bonus for that frame is the value of the next two balls rolled. In the tenth frame a player who rolls a spare or strike is allowed to roll the extra balls to complete the frame. However no more than three balls can be rolled in tenth frame.”

You can find my C# solution here, but you should not look at it before you tried to implement it by yourself.

Have fun…