Monday, September 29, 2014

DSC Resource Property Name Cannot Be 'scope'

Been doing a lot of custom DSC resource work lately, and now have some seriously good coverage of FIM configuration object types in the FIM Service.  Best part is, I got through most of them without hitting any major snags in PowerShell Desired State Configuration (solid work by the PowerShell team!).

On my last custom DSC resource, I tried to add a property name of ‘Scope’, since I was working with the Group object type which has an attribute named ‘Scope’.  I created the DSC resource provider just fine but when I went to write the tests for it I got a generic DSC error:

PSDesiredStateConfiguration\Node : The term 'cFimGroup' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,

verify that the path is correct and try again.

PowerShell does a great job with error messages usually, but this one wasn’t specific enough to make debugging easy (at least for me).  It took me a while to track down but I figured out that you can’t use the word ‘Scope’ as the name of a DSC resource property.

Anyhow, I have a workaround but managed to file a bug for PowerShell (vote for it if you hit this too, but I suspect nobody will have this specific problem): DSC Resource Property Name Cannot Be 'scope'.  Kinda neat to finally find a bug in PowerShell, but even so it doesn’t matter so much because the workaround is pretty simple.

No comments: