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. 

Add comment