Write your first DSC Resource in Go

With DSC v3, you can author command-based DSC Resources in any language. This enables you to manage applications in the programming language you and your team prefer, or in the same language as the application you’re managing.

This tutorial describes how you can implement a DSC Resource in Go to manage an application’s configuration files. While this tutorial creates a resource to manage the fictional TSToy application, the principles apply when you author any command-based resource.

In this tutorial, you learn how to:

  • Create a small Go application to use as a DSC Resource.
  • Define the properties of the resource.
  • Implement get and set commands for the resource.
  • Write a manifest for the resource.
  • Manually test the resource.

Prerequisites #

  • Familiarize yourself with the structure of a command-based DSC Resource.
  • Read About the TSToy application, install tstoy, and add it to your PATH.
  • Go 1.19 or higher
  • VS Code with the Go extension

Steps #

  1. Create the DSC Resource
  2. Define the configuration settings
  3. Handle input
  4. Implement get
  5. Implement set
  6. Author the DSC Resource manifest
  7. Validate the DSC Resource with DSC
  8. Review and next steps
Code License Prose License Terms of Use Privacy Policy Code of Conduct