If you started to learn Microsoft’s approach to Configuration as Code and found out what Desired State Configuration is, you probably tried to scrutinize PowerShell DSC resources code on GitHub in didn’t get it.
For ones who need to know how it works and how to find out resource parameters, I recommend to read the following articles (in the order provided):
- Understanding CONFIGURATION keyword … from PowerShell Team.
- Hungry for more Windows PowerShell Desired State Configuration Resources? from PowerShell Team.
- Anatomy of a PowerShell DSC Resource from Dr Scripto.
It helped me very much.
Now, imagine you found some DSC resource module, for instance cChoco
(in PowerShell Gallery, on GitHub), and you need to know what properties its resources have. Super helpful may be command Get-DscResource
, applied like:
.. which outputs something like:
It says, parameters Name, AutoUpgrade, chocoParams, DependsOn, Ensure, Params, PsDscRunAsCredential, Source, Version available to you if you build configuration like:
By the way, if you install OpenSSH server don’t forget about Params with the value like ’“/SSHServerFeature /KeyBasedAuthenticationFeature”’, otherwise you get into the story as I got.