Custom images or formulas?


In our last post, it's mentioned that Azure DevTest Labs introduced a new way to create lab VMs, which is called Formulas. Meanwhile, we've also released an Azure service update recently that describes more details on what you can get from it and how you can use/create it. Basically speaking, it's a reusable template that captures all the settings needed for VM creation. It introduces another way to create lab VMs in addition to custom images.

Given the two options to create VMs in the lab, you may ask, when should we use formulas vs. custom images? So let's do a quick pros-and-cons comparison for each option in this post.

Custom images:

Custom images support in the lab provides a static/immutable way to create VMs from a desired environment.

  • Bright side:
    • VM provisioning from a custom image is usually very fast, since nothing change (no software to install or system settings to update) after the VM is spun up from an image.
    • All settings/configuration is locked down and baked in the images, so it forces all the VMs are identical if using the same images.
  • Down side:
    • Every time when changes happen in the environment, a new custom image needs to be generated and maintained, which requires extra effort.

Formulas:

As mentioned earlier, Formulas is basically a reusable and editable template. It provides a dynamic way to create VMs from the desired configuration/settings.

  • Bright side:
    • Changes in the environment can be captured on the fly, thanks to artifacts. It means no extra cost to generate or maintain new custom image files. E.g. if you want a VM installed with the latest bits from your release pipeline (or enlist the latest code) from your repository, you can simply specify an artifact that deploy the latest bits (or enlist the latest code) in the formula together with a target base image. So that whenever this formula is used to create VMs, it's always the latest bits/code that are deployed/enlisted to the VM.
      • Bonus: The public DevTest Labs GitHub repo has already offered the artifacts for deploying the latest drop from VSTS and cloning a Git repository respectively. You can leverage and customize those to meet your own needs. Artifacts from this public repo is available to all the DevTest labs by default.
    • Formulas can define default settings that custom images cannot provide, including VM sizes and the virtual network, etc..
    • All the settings saved in a formula are shown as default values, but users still can change the values when formulas are used to create the VM. So it's more flexible to feed multiple needs. E.g. you can change the base image between different versions of Windows (or Linux) for compatibility testing, but keep all the other VM creation settings (artifacts, virtual networks etc.) the same.
  • Down side:
    • Because of the "base image + artifacts" model, it takes additional time after the VM is created from a base image when using artifacts to install extra software or running some system configurations.

Custom images + Formulas:

The world is not simply black and white, so is the DevTest Labs regarding to the custom images and formulas! When Custom images and Formulas are used as a combination, you get all the beauties as described above. For the software/settings/configurations that don't change often, you can bake them into a custom image, and then define your formula with that custom image as the base plus the "dynamics" installed through artifacts and default values for the other settings.

Hopefully this short post gives you a better idea how you can optimize the usage of formulas and custom images in the DevTest Labs. As always, we'd love to hear from you. Please give it a try and feel free to let us know if you have any questions or feedback.

Enjoy!


Comments (0)

Skip to main content