Get Started with Microsoft Desired State Configuration v3.0.0
Jason Helmick walks through the installation and basics of Microsoft Desired State Configuration v3.0.0, helping IT professionals and developers automate infrastructure management using PowerShell.
Get Started with Microsoft Desired State Configuration v3.0.0
By Jason Helmick
Microsoft Desired State Configuration (DSC) v3.0.0 is a modern, cross-platform configuration management framework used by administrators and developers to declaratively define and enforce system states. DSC simplifies automation for both infrastructure and application deployment using configuration as code principles.
Key Terminology
- DSC: Desired State Configuration v3.0.0
- PSDSC: PowerShell Desired State Configuration (earlier versions v1.1, v2)
Installing DSC
-
On Windows: Install DSC from the Microsoft Store using
winget
, which enables automatic updates.winget search DesiredStateConfiguration winget install --id <insert-package-id> --source msstore
-
On Linux/macOS:
- Download the latest release from PowerShell/DSC releases.
- Expand the release archive.
- Add the expanded archive folder to your
PATH
environment variable.
Getting Started with the dsc
Command
-
Display command help:
dsc --help
- Key options include tracing and output format settings, plus subcommands for managing configurations and resources (e.g.,
config
,resource
,schema
). -
Check version:
dsc --version # Output: dsc 3.0.0
- dsc command reference documentation
Accessing DSC Resources
-
List all installed DSC resources:
dsc resource list
-
Use adapters (e.g., classic PowerShell resources via
Microsoft.Windows/WindowsPowerShell
):dsc resource list --adapter Microsoft.Windows/WindowsPowerShell
Managing Basic Configurations
-
Example YAML configuration to install IIS on Windows Server (using classic PowerShell resource
WindowsFeature
):$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json resources: - name: Use Windows PowerShell resources type: Microsoft.Windows/WindowsPowerShell properties: resources: - name: Web server install type: PSDesiredStateConfiguration/WindowsFeature properties: Name: Web-Server Ensure: Present
-
Apply configuration with:
dsc config get --file ./web.comfig.dsc.yaml
Next Steps
- Learn more about authoring and enhancements in DSC v3 through enhanced authoring documentation
- Official DSCv3 documentation
- Participate by providing feedback on the PowerShell DSC GitHub repository
Sr. Product Manager, PowerShell
Jason Helmick
This post appeared first on “Microsoft PowerShell Blog”. Read the entire article here