Over the past 12 months I have been working with customers on hackfests. We often work with organizations that have highly secured workstations and networks. This proves to be a problem as during the hackfest we need to be using the latest releases of software, often preview releases, and also need full access Microsoft Azure.
In a recent scenario we needed to work with Visual Studio 2017 and Windows Server containers. The hackfest participants laptops were running Windows 7, an older version of Visual Studio and had limited outbound internet access. To ensure participants could work with the latest technologies we deployed Azure DevTest Labs to create custom developer workstations that could then be accessed via RDP.
When deploying a Virtual Machine in DevTest Labs you select a base image and can choose a number of artifacts that will be installed onto the base image. Although separate images exist for Visual Studio 2017 and for Windows Server 2016 Datacenter with Containers, there is not a single image with both. This meant we had two options, create a custom image, or create an artifact that would enable Windows container functionality on a Visual Studio 2017 Image. I decided to create a custom Docker artifact as if I was to create an image with all the prerequisites installed every time VS 2017 needs updating the entire image would need to be updated. It would also men I could publish the artifact for use at later events.
There is a public repository on GitHub that contains existing artifact definitions https://github.com/Azure/azure-devtestlab . The artifacts within the “Public Repo” can be seen inside the Azure portal when deploying a DevTest lab VM:
Adding a custom repository
The first step was to fork the existing repository. I could have created a new repository from scratch, but wanted to be able to easily create a pull request back to the Azure/azure-devtestlab repository and use the existing examples as templates.
I added my fork of the repository to DevTest Labs:
I could now see duplicate artifacts within my fork alongside the artifacts within the public repo in the portal:
Creating the artifact
There are detailed instructions for authoring artifacts, within the repository – https://github.com/Azure/azure-devtestlab/blob/master/Documentation/AUTHORING.md. The basics construct of an artifact is that it is in its own folder that contains a JSON file, artifact.json along with any associated scripts. The artifact.json file includes metadata about the artifact, a URL to an icon, and the command to execute. The file I created is as follows:
The file InstallDocker.ps1 is executed by using Windows PowerShell; it is simply two commands.
After the hackfest was complete and the artifact had been used multiple times, I submitted a pull request (https://github.com/Azure/azure-devtestlab/pull/209 ), which was accepted and the artifact can now be seen in the public repository in the Azure portal.
The full technical write up of the hackfest can be found here: https://microsoft.github.io/techcasestudies/devops/2017/06/16/Callcredit_DevOps.html