That is the second submit in a multi-part collection in regards to the new launch of DSC.
Microsoft Desired State Configuration (DSC) v3.0.0 is a contemporary, cross-platform configuration
administration framework designed to assist directors and builders declaratively outline and implement
system states. Whether or not you’re managing infrastructure, deploying purposes, or automating system
configurations, DSC supplies a versatile and scalable method to configuration as code.
TIP
This submit 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.
Putting in DSC
To get began, comply with these steps to put in DSC in your system:
On Home windows, you possibly can set up DSC from the Microsoft Retailer utilizing winget
. By putting in from the
Retailer or utilizing winget
, you get computerized updates for DSC.
winget search DesiredStateConfiguration
winget set up --id <insert-package-id> --source msstore
On Linux and macOS, you possibly can set up DSC utilizing the next steps:
- Obtain the most recent launch from the PowerShell/DSC repository.
- Broaden the discharge archive.
- Add the folder containing the expanded archive contents to your
PATH
setting variable.
Getting began with the DSC command
The dsc
command operates on a configuration doc or invokes particular assets to handle
settings.
Run the next command to show the dsc
command assist:
dsc --help
Apply configuration or invoke particular DSC assets
Utilization: dsc.exe [OPTIONS] <COMMAND>
Instructions:
completer Generate a shell completion script
config Apply a configuration doc
useful resource Invoke a selected DSC useful resource
schema Get the JSON schema for a DSC kind
assist Print this message or the assistance of the given subcommand(s)
Choices:
-l, --trace-level <TRACE_LEVEL> Hint degree to make use of [possible values: error, warn, info, debug, trace]
-t, --trace-format <TRACE_FORMAT> Hint format to make use of [default: default] [possible values: default, plaintext, json]
-h, --help Print assist
-V, --version Print model
Use the command to get model info.
dsc --version
dsc 3.0.0
To study extra, see the dsc
command reference documentation.
Entry DSC assets with dsc useful resource
The dsc useful resource
command shows or invokes a selected DSC useful resource. The dsc useful resource
command
incorporates subcommands for itemizing DSC assets and invoking them immediately.
Use the next command to show a listing of put in DSC assets.
dsc useful resource checklist
Sort Variety Model Caps RequireAdapter Description
----------------------------------------------------------------------------------------------------
Microsoft.DSC.Transitional/RunCommandOnSet Useful resource 0.1.0 gs------ Takes a si…
Microsoft.DSC/Assertion Group 0.1.0 gs--t--- `check` wil…
Microsoft.DSC/Group Group 0.1.0 gs--t--- All resour…
Microsoft.DSC/PowerShell Adapter 0.1.0 gs--t-e- Useful resource a…
Microsoft.Home windows/RebootPending Useful resource 0.1.0 g------- Returns in…
Microsoft.Home windows/Registry Useful resource 0.1.0 gs-w-d-- Handle Win…
Microsoft.Home windows/WMI Adapter 0.1.0 g------- Useful resource a…
Microsoft.Home windows/WindowsPowerShell Adapter 0.1.0 gs--t--- Useful resource a…
When the command consists of the adapter choice, dsc
checks for any useful resource adapters with an identical
title. Traditional PowerShell assets are a part of the Microsoft.Home windows/WindowsPowerShell
adapter.
dsc useful resource checklist --adapter Microsoft.Home windows/WindowsPowerShell
Partial itemizing
Sort Variety Model Caps RequireAdapter
----------------------------------------------------------------------------------------------------
PSDesiredStateConfiguration/Archive Useful resource 1.1 gs--t--- Microsoft.Windo…
PSDesiredStateConfiguration/Surroundings Useful resource 1.1 gs--t--- Microsoft.Windo…
PSDesiredStateConfiguration/File Useful resource 1.0.0 gs--t--- Microsoft.Windo…
PSDesiredStateConfiguration/Group Useful resource 1.1 gs--t--- Microsoft.Windo…
PSDesiredStateConfiguration/GroupSet Useful resource 1.1 gs--t--- Microsoft.Windo…
PSDesiredStateConfiguration/Log Useful resource 1.1 gs--t--- Microsoft.Windo…
To study extra, see the dsc
useful resource command reference documentation.
Handle a fundamental configuration
The dsc config
command consists of subcommands for managing the useful resource situations outlined in a DSC
configuration doc.
The next YAML configuration doc calls the basic PowerShell useful resource WindowsFeature
from the PSDesiredStateConfiguration module to put in a Home windows internet server (IIS) on Home windows
Server.
$schema: https://uncooked.githubusercontent.com/PowerShell/DSC/primary/schemas/2024/04/config/doc.json
assets:
- title: Use Home windows PowerShell assets
kind: Microsoft.Home windows/WindowsPowerShell
properties:
assets:
- title: Net server set up
kind: PSDesiredStateConfiguration/WindowsFeature
properties:
Title: Net-Server
Guarantee: Current
To set a machine to the configuration, use the dsc config set
subcommand. The next instance
exhibits how one can ship the configuration doc to DSCv3 utilizing PowerShell:
dsc config get --file ./internet.comfig.dsc.yaml
To study extra, see the dsc config
command reference documentation.
Subsequent steps
Be taught extra about Authoring Enhancements in Desired State Configuration v3.0.0.
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