Microsoft DSC v3 is a simple, single executable tool that helps you declare and enforce the desired state of your systems in a cross-platform way.
Microsoft Desired State Configuration (DSC) v3 is a cross-platform tool that lets you describe how you want your system to look and behave. You write a configuration document in JSON, Bicep, or YAML describing the desired state and Microsoft DSC v3 ensures your machines matches the state.
For example, what file and folders should always exist or which services should be running always.
To learn why you want to use Microsoft DSC v3, check out the following article
The following sections demonstrate how you can install Microsoft DSC v3 on the different platforms and methods.
To install Microsoft DSC v3 on all platforms, you can use a community PowerShell module which runs on PowerShell 7+:
PSDSC
module by typing:Install-PSResource -Name PSDSC -Repository PSGallery
Install-DscExe
in your terminal sessionInstall-DscExe
You can also install pre-release version by adding the IncludePreRelease
switch parameter.
The command automatically adds the dsc
executable to the PATH
environment variable.
The WinGet community package repository also contains dsc
. For more information, check out the Install DSC on Windows with WinGet (only applies to Windows).
To install Microsoft DSC v3 on Windows using GitHub, you first should determine your OS architecture. There are multiple ways to determine the operating system (OS) architecture. The following three demonstrate using the command prompt, PowerShell, or msinfo.
After determining your OS architecture, proceed to download the release asset from GitHub.
When the download is finished, you can expand the files to extract them to your application data folder.
C:\Users\<userProfile>\AppData\Local\dsc
by replacing the <userProfile>
with your profile name.rundll32.exe sysdm.cpl,EditEnvironmentVariables
to open the environment variables.PATH
environment variable and include the path C:\Users\<userProfile>\AppData\Local\dsc
.Verify the installation by re-opening a command prompt and typing: dsc --version
To quickly learn about Microsoft DSC v3, let’s create a configuration document that gets the operating system information on your system.
Create the following YAML file:
# osinfo.dsc.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: os
type: Microsoft/OSInfo
properties:
family: Windows
Run the following command to get the current state
dsc config get --file osinfo.dsc.yaml
It is also possible to get the current state by running dsc resource get -r Microsoft/OSInfo
without needing a configuration file.
Microsoft DSC v3 redefines the DSC experience by providing a single executable into a lightweight and cross-platform tool. It seamlessly fits into modern DevOps pipelines. With a new concept called adapters, existing DSC resource are still able to be executed. Start small to learn the new resource syntax and build up to automate your entire infrastructure.
Happy configuring!