Creating reusable DSC configurations
So far, we have been working with singular DSC configuration script files and DSC Configuration
blocks. We have taken an approach of one DSC Configuration
block per script file, and one script file per environment. We covered why this was best practice in the earlier sections, and at this point you've probably tried out a couple on your own using what we have done so far. You are likely realizing that these script files can grow very large, containing hundreds of lines of code with large sections of just DSC Resource declaration statements.
This is a common problem with CM. The world is complex and messy, and declaring it in text files sounds easy at first but becomes difficult to maintain if all you have is one big ball of lines without some organization. If you have developed scripts or code in any language, you are familiar with a common solution to the "big ball of mud" problem: encapsulation. Encapsulation involves extracting the common...