This is the third post in a multi-part series about the new release of DSC.
Microsoft Desired State Configuration (DSC) v3.0.0 provides powerful feature that enhance the authoring experience.
- Shell completion
- Schema-based validation
- Support for modern DSLs like Azure Bicep
TIP
This post uses the following 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 following shells:
To learn more, see the dsc completer
command reference documentation.
Enhanced Authoring with Schemas
Working with DSC platform involves writing configuration documents and resource manifests. DSC validates these data files using a JSON schema. While the DSC schemas are useful for authoring, DSC also includes a set of enhanced schemas for authoring the files in VS Code.
These schemas define extra keywords specific to VS Code that:
- Improve the contextual help when hovering on or selecting a property in the data file.
- Add contextual help for enum values.
- Improve the error messages for invalid values.
- Add default snippets to autocomplete values.
To learn more, see Authoring with Enhanced Schemas.
Authoring with Bicep (Coming soon!)
Bicep is Microsoft’s domain specific language (DSL) for creating declarative Azure Resource Manager (ARM) deployments. It offers a clean, intuitive syntax that makes writing and maintaining DSC configurations more efficient. By using Bicep as a DSL, DSC users enjoy the benefits of strong validation, modularity, and seamless integration with Azure-native tooling, without the complexity of authoring in JSON or YAML.
You can write and invoke Bicep configurations locally–without access to Azure–or as part of your Azure deployments, combining Infrastructure as code (IaC) and Configuration as code (CaC).
The following Bicep configuration document calls the classic PowerShell resource WindowsFeature
from the PSDesiredStateConfiguration module to install the IIS web server feature 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'
}
}
]
}
}
By default, a Bicep file is scoped to a Bicep resource. To use Bicep with DSC, you must set the
scope to dsc
. Bicep support is still being developed. We’ll make an announcement when Bicep
support and documentation is available.
Call to action
For more information about DSC v3.0, see the DSCv3 documentation. We value your feedback. Stop by our GitHub repository and let us know of any issues you find.
Jason Helmick
Sr. Product Manager, PowerShell
0 comments
Be the first to start the discussion.