Tuesday, April 22, 2025
HomePowershellAuthoring Enhancements in Microsoft Desired State Configuration v3.0.0

Authoring Enhancements in Microsoft Desired State Configuration v3.0.0


That is the third put up in a multi-part collection concerning the new launch of DSC.

Microsoft Desired State Configuration (DSC) v3.0.0 supplies highly effective characteristic that improve the authoring expertise.

  • Shell completion
  • Schema-based validation
  • Assist for contemporary DSLs like Azure Bicep

TIP

This put up makes use of the next terminology:

  • DSC refers to Desired State Configuration (DSC) v3.0.0.
  • PSDSC refers to PowerShell Desired State Configuration (PSDSC) v1.1 and v2.

DSC command completer

The completer command returns a shell script that, when executed, registers completions for the
given shell.

DSC can generate completion scripts for the next shells:

To be taught extra, see the dsc completer command reference documentation.

Enhanced Authoring with Schemas

Working with DSC platform entails writing configuration paperwork and useful resource manifests. DSC
validates these information recordsdata utilizing a JSON schema. Whereas the DSC schemas are helpful for authoring, DSC
additionally features a set of enhanced schemas for authoring the recordsdata in VS Code.

These schemas outline further key phrases particular to VS Code that:

  • Enhance the contextual assist when hovering on or deciding on a property within the information file.
  • Add contextual assist for enum values.
  • Enhance the error messages for invalid values.
  • Add default snippets to autocomplete values.

To be taught extra, see Authoring with Enhanced Schemas.

Authoring with Bicep (Coming quickly!)

Bicep is Microsoft’s area particular language (DSL) for creating declarative Azure Useful resource
Supervisor (ARM) deployments. It provides a clear, intuitive syntax that makes writing and sustaining
DSC configurations extra environment friendly. Through the use of Bicep as a DSL, DSC customers take pleasure in the advantages of sturdy
validation, modularity, and seamless integration with Azure-native tooling, with out the complexity
of authoring in JSON or YAML.

You’ll be able to write and invoke Bicep configurations regionally–with out entry to Azure–or as a part of
your Azure deployments, combining Infrastructure as code (IaC) and Configuration as code (CaC).

The next Bicep configuration doc calls the traditional PowerShell useful resource WindowsFeature
from the PSDesiredStateConfiguration module to put in the IIS net server characteristic on Home windows
Server.

targetScope="dsc"
useful resource powershellAdapter 'Microsoft.Home windows/WindowsPowerShell@2025-01-07' = {
  title: 'Net server set up'
  properties: {
    sources: [
      {
        name: 'Run WindowsFeature'
        type: 'PSDesiredStateConfiguration/WindowsFeature'
        properties: {
          Name: 'Web-server'
          Ensure: 'Present'
        }
      }
    ]
  }
}

By default, a Bicep file is scoped to a Bicep useful resource. To make use of Bicep with DSC, you should set the
scope to dsc. Bicep assist continues to be being developed. We’ll make an announcement when Bicep
assist and documentation is accessible.

Name to motion

For extra details about DSC v3.0, see the DSCv3 documentation. We worth your suggestions. Cease
by our GitHub repository and tell us of any points you discover.

Jason Helmick

Sr. Product Supervisor, PowerShell

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments