Fast Start: Infrastructure as Code using Azure DevTestLabs

Alot of folks understand that Infrastructure as Code (aka IaC) is a great idea and an advanced concept of DevOps. What alot of folks don’t realize though when they begin their journey that there are alot of tools and alot of different ways to start.

At Microsoft we have numerous ways to get started with IAC. One of the easiest ones is to take advantage of Azure’s DevTestLabs and VSTS (Visual Studio Team Services). Together these two technologies make it super easy to get started on the road to being able to deploy on-demand and anytime.

Let’s get started.

Pre-Reqs:

1. You’ll need a Microsoft Azure account (sign up for free today here)

2. VSTS account (sign up for free at www.visualstudio.com )

Next we’ll need a sample application to deploy. I added a simple ASP.net website to my git repo in VSTS along with two other important scripts.

dtl1

Note: I’ve stored my sample project along with the two needed scripts in my GitHub repo located here.

Basically the file dtlvmtemplate.json is the templatized form of a web app which I downloaded directly from Microsoft Azure. The other script InstallApp.ps1 is a DSC piece of code which takes care of making sure IIS is installed, that ASP.NET is installed and configuring the website on this new server.

Steps to re-create this on VSTS.

1. Import the git repo into VSTS.

2. Next we need to setup a CI build in VSTS which will build the application AND publish the deployment scripts folder as an artifact so it’s available for Release.dtl2

3. With a successful build we need to setup a Release which will call the deployment scripts AND deploy our sample application. dtl3

4. And finally just add a call Remote Powershell on the newly created server to deploy the application.

As you can tell this is pretty quick and obviously a very simple example but it can easily be expanded upon for larger multi-tier applications.

As always feel free to reach out with any issues.

Sharing Deployment Groups Across Team Projects in VSTS

One of the many recent enhancements to VSTS (Visual Studio Team Services) is the adding of Deployment Groups back in 2017. However ever since they were added the next obvious question was: How do I share these across my Team Projects (similar to how Agents work across Team Projects). This scenario is useful in order to allow organizations to take full advantage of their infrastructure and maximize the return on investment in cloud technologies such as Microsoft Azure.

Much like Agents there is a “Deployment Pool” which is actually the mechanism which allows the sharing across Team Projects. Initially there was a one to one mapping of Deployment Pool to Group but customers quickly realized the potential use for these groups.

There are some requirements that must be met before these Deployment Pools can be shared/used:

1. The user sharing the Deployment Pool must be a user for the pool.

2. The user sharing the Deployment Pool must have permissions to create a Deployment Group in the new Team Project where we wish to share it.

3. The new Team Project must not already have a Deployment Group backed by the same pool.

How to share the Deployment Groups/Pools?

1. Go to the Deployment Group in your existing TP and select Manageblog1

2. Select which Team Projects you want to share these Deployment Groups with blog2

3. Now when you navigate to the new Team Project you will see the Deployment Group listed under it (backed by the same Deployment Pool).blog3

Hopefully this will help folks realize how versatile VSTS is and help someone get on the road to DevOps faster. As always if you have any issues don’t hesitate to reach out.