DevOpsGroup has joined Sourced, an Amdocs company. Read more about this partnership and what this means for the future in our blog.

DevOpsGroup Blog DSC Tooling: cDscResourceDesigner and DscDevelopment

DSC Tooling: cDscResourceDesigner and DscDevelopment

In PowerShell v4 – the first release of Desired State Configuration – the experience of authoring DSC resource modules isn’t terribly pleasant.  You have to produce both a PowerShell module and a schema.mof file, both of which have to follow certain rules, and agree with each other about the parameters that can be passed to the module’s commands.  If you get it wrong, your resource won’t work.

One of the extra DSC-related goodies Microsoft has released is an experimental module called xDscResourceDesigner.  It contains several functions that help to take the pain out of this authoring experience.  For example, you can run a Test command on a resource to make sure that its PSM1 file and schema.mof are both legal and in sync.  DscDevelopment, another of Steve Murawski’s modules from Stack Exchange, takes this concept a step further, and allows you to do things like automatically generate a schema.mof file from a PSM1 file.

cDscResourceDesigner is a community-modified version of the original xDscResourceDesigner module.  Most of our focus, so far, has been on the Test-cDscResource function, which is called from Invoke-DscBuild and becomes part of our continuous delivery pipeline.

Microsoft’s experimental version of this Test command was pretty good, but it would report failures on some modules and schema files that are perfectly valid, as far as WMI and the Local Configuration Manager are concerned.  In fact, several of Microsoft’s own DSC resources (both experimental and those included in PowerShell 4.0) would fail the tests of the original version of this command.  We’re working on identifying and fixing these types of false failures, so the Test-cDscResource command can be trusted as a reliable reason to fail a build.

We’ve also got an eye on the future.  One of the big DSC-related enhancements coming in PowerShell v5 is the ability to author resources using a new class definition language.  There will no longer need to be a schema.mof file separate from the PowerShell code, as the class definitions will contain enough information for DSC to do everything it needs to do. 

Once that new version is released and deployed, you’ll have a much better experience by using this new resource definition language.  At that time, we plan to add new commands to DscDevelopment or cDscResourceDesigner which will allow you to automatically convert resource modules between v4 and v5 syntax, in either direction.

Leave a Reply

Your email address will not be published. Required fields are marked *