Authored by Jason Helmick, this post introduces key authoring enhancements in Microsoft Desired State Configuration v3.0.0, designed to streamline the configuration and deployment processes for PowerShell and Azure environments.

Authoring Enhancements in Microsoft Desired State Configuration v3.0.0

This is the third post in a multi-part series about the new release of DSC.

Microsoft Desired State Configuration (DSC) v3.0.0 delivers several notable features to enhance the configuration authoring experience:

  • Shell completion
  • Schema-based validation
  • Support for modern DSLs like Azure Bicep

Terminology

  • DSC: Refers to Desired State Configuration v3.0.0.
  • PSDSC: Refers to PowerShell Desired State Configuration v1.1 and v2.

DSC Command Completer

The DSC command completer returns a shell script that, when executed, registers shell completions for DSC. This helps users benefit from command auto-completion and improved workflows.

DSC can generate completion scripts for the following shells:

Learn more in the dsc completer command reference documentation.

Enhanced Authoring with Schemas

When authoring configuration documents and resource manifests with DSC, JSON schemas are used to validate these files. Enhanced schemas are provided for use in Visual Studio Code. These schemas offer:

  • Improved contextual help (especially for hovering/selecting properties)
  • Contextual help for enumerated values
  • Improved error messages for invalid values
  • Default value snippets to autocomplete values

This improves productivity, reduces errors, and provides richer context for users within their development environment.

To learn more, see Authoring with Enhanced Schemas.

Authoring with Bicep (Coming Soon)

Bicep is Microsoft’s domain-specific language (DSL) for ARM (Azure Resource Manager) deployments. Bicep introduces an intuitive syntax, strong validation, modularity, and seamless integration with Azure-native tooling, enhancing the authoring of DSC configurations.

Key Features of Using Bicep with DSC

  • Clean, maintainable syntax relative to JSON or YAML
  • Local invocation or integration with Azure deployments
  • Combines Infrastructure as Code (IaC) with Configuration as Code (CaC)

Example Bicep configuration invoking the classic WindowsFeature PowerShell resource to install IIS on Windows Server:

targetScope = 'dsc'
resource powershellAdapter 'Microsoft.Windows/WindowsPowerShell@2025-01-07' = {
  name: 'Web server install'
  properties: {
    resources: [
      {
        name: 'Run WindowsFeature'
        type: 'PSDesiredStateConfiguration/WindowsFeature'
        properties: {
          Name: 'Web-server'
          Ensure: 'Present'
        }
      }
    ]
  }
}

Note: By default, Bicep files are scoped to a Bicep resource. To leverage DSC authoring with Bicep, set the scope to dsc. Bicep support is currently under development, and further announcements will follow.

For More Information


Authored by Jason Helmick, Sr. Product Manager, PowerShell.

This post appeared first on “Microsoft PowerShell Blog”. Read the entire article here