You are currently viewing Microsoft Dev Field meets configuration as code

Microsoft Dev Field meets configuration as code

Microsoft Dev Field, Microsoft’s cloud-hosted developer environments, not too long ago entered normal availability, able to run with a mixture of Home windows pictures and a spread of VMs with totally different capabilities. Absolutely customizable and centrally manageable, Dev Bins let you tune your growth setting for the work your workforce is doing. As instruments like the brand new Dev Drive and Dev Dwelling roll out throughout Home windows, you can be ready to shortly arise new remoted developer methods that use resilient digital drives and that hyperlink immediately into Git-based workflows.

Instruments like Dev Field make excellent sense for organizations that have to shortly on-board new builders, or that work with contractors and different contingent employees and wish to manage their environments. The identical method works nicely with distant employees, the place assigning them Dev Bins ensures that your code and their private tasks don’t combine and that they’ll use their very own {hardware} with out handing over full management. All they want is a machine that may run a distant desktop session.

At Construct 2023 in Could, Microsoft famous that almost 10,000 of its personal engineers had been already utilizing Dev Bins as a part of their toolchain, rushing up on-boarding for brand new tasks. The corporate makes use of a mixture of self-service and pre-configured pictures, with project-specific and role-specific cases in addition to Azure-based digital networks for securely connecting engineers to the assets they want. Getting began with a pre-configured Dev Field means engineers may be productive extra shortly, even whereas they add their very own favourite settings and add-ons to the offered digital environments.

However there’s nonetheless work to be executed, if we’re to automate the provisioning of developer environments. What’s wanted is greater than Workplace and Visible Studio. We want a strategy to provision all the parts that make up a toolchain, from editors and design instruments to platforms and testing frameworks, together with the libraries and SDKs wanted to construct code.

Customizing Dev Bins with code

Microsoft is rolling out a brand new set of “config as code” instruments, at present in personal preview, to ease the customization of Dev Bins. The brand new instruments use YAML to outline Dev Field pictures and run setup duties, which set up the instruments you want by way of acquainted bundle managers like Chocolatey and Winget. These duties can even work with the Visible Studio installer so as to add extensions. You may as well allow Home windows options like Home windows Subsystem for Linux and Home windows Subsystem for Android, extending your toolchain past Home windows.

One helpful new function for configuring a Dev Field comes from the Home windows Bundle Supervisor, WinGet, with its new configuration tooling. This lets you outline the state of your software program set up utilizing a YAML configuration file and PowerShell’s Desired State Configuration (DSC) tooling. This method permits WinGet configurations to be declarative, describing the tip state of an set up course of, not the steps wanted to get there.

To make use of WinGet configuration recordsdata, you will want to allow WinGet’s experimental options, as this function is at present in preview. Step one is to obtain and set up the present WinGet preview (the mandatory MSI installer is linked from this Microsoft Study web page). You must also get accustomed to the WinGet configuration schema, at present in model 0.2.

As soon as prepared to make use of, WinGet will first examine for a legitimate configuration file, earlier than utilizing PowerShell DSC to handle the set up course of. Installs can occur in any order, and even in parallel. The one sequencing comes the place there are outlined dependencies. For instance, if an assertion on an software model fails, then the ensuing steps gained’t run. Nonetheless, that gained’t cease the remainder of a configuration from finishing, so you will want to check an set up earlier than deploying it to your Dev Field fleet. Any errors will probably be displayed in your console or written to log recordsdata.

There’s a sure logic to working configurations non-sequentially. For one factor it means that you can group parts the best way you need with a view to make the YAML extra readable. For instance, you would have a bit for SDKs, one other for developer instruments and languages, and one other for required companies and purposes. Then updates might be shortly added in the best place, serving to you retain observe of modifications and letting you shortly evaluate totally different variations of your configurations—in addition to making it doable to customise installs for various roles in a workforce.

Authoring WinGet configuration recordsdata

So how do you create a WinGet configuration file? A lot of that is based mostly on PowerShell’s DSC administration mannequin, so there’s a particular hyperlink between how DSC works and the construction of a WinGet configuration. There are two components to a configuration file. The primary particulars assertions, that are the bottom state obligatory for a set of software program installs to finish. The second describes assets, the software program to be put in and any configuration settings.

Assertions use DSC modules to work with the underlying OS, and you may specify particular variations, or minimal and even most variations. You need to begin by utilizing these to make sure that your Dev Bins have the best base configuration earlier than putting in further options and purposes. Equally, your YAML will outline the mandatory assets, which may embody making certain that sure OS mode switches are enabled, in addition to including workloads to put in purposes, which could entail loading further configuration recordsdata for tooling like Visible Studio. Once more, you’re utilizing the configuration file to automate DSC modules, with the WinGet module dealing with installs and purposes’ personal modules managing configurations.

Consider a WinGet configuration as an inventory of useful resource nodes. These are the primary YAML parts in every part of the file, containing the directions wanted to both set up or configure part of your toolchain. Every useful resource comprises a directive, within the form of a DSC module, and the mandatory settings as key/worth pairs. Every useful resource can require one other to be accomplished earlier than it runs (making certain that Visible Studio has been put in earlier than you configure it, for instance).

DSC modules are straightforward to search out, both in Microsoft’s personal repository of supported modules or in the neighborhood PowerShell Gallery. You possibly can even creator your individual, for putting in in-house instruments or comparatively uncommon purposes.

Testing WinGet configurations

In the event you’re going to automate installs utilizing WinGet configuration recordsdata, then it’s necessary to make sure that the modules you’re utilizing are reliable and your YAML works as anticipated. Whereas you should use a sacrificial Dev Field setting for last checks, preliminary checks are finest run utilizing your individual Home windows digital machines and even Home windows’ built-in Sandbox, which throws away its contents on each reboot. As soon as examined you’ll be able to embody the WinGet configuration file in your Dev Field setup YAML.

Utilizing code to configure our Dev Bins is a vital step ahead, because it permits us not solely to hurry up configurations, but in addition retailer the code we use for constructing growth environments in the identical repositories because the code we’re constructing. It’s straightforward to think about an extension for the brand new Dev Hub software that connects to GitHub, downloads a setup file, and automates each setup and configuration, permitting us to construct a growth setting at a click on of a button, prepared to begin coding.

Copyright © 2023 IDG Communications, Inc.

Leave a Reply