If you have private DSC resources, you can convert them to a Puppet module.
DSC Resources are automatically synced with the PowerShell Gallery. If you publish a module to the PowerShell Gallery, it appears in Puppet
Forge the following day. However, some PowerShell modules contain internal business logic and
are not published to the PowerShell gallery. Follow this
guide to convert your private DSC Resources to a Puppet
module, using the Puppet.dsc PowerShell module.
-
Run the following command to install the
Puppet.dsc
PowerShell module:
PS C:\Users\Administrator> Install-Module -Name Puppet.Dsc
This command provides the New-PuppetDscModule
function that builds Puppet modules out of
PowerShell resources.
The Puppet.Dsc
module retrieves the source PowerShell module from a PSRepository feed.
In most cases, this is the standard PowerShell
Gallery, but it can use any feed you specify.
The following example points a PSRespository to a development
environment where maintained PowerShell
modules are stored. PowerShell can use either
a local or shared folder as the source.
# Make sure you specify the correct parameters
PS> Register-PSRepository -Name YourRepository -SourceLocation 'C:\Users\YourName\Projects\PowershellModules' -ScriptSourceLocation 'C:\Users\YourName\Projects\PowershellModules' -InstallationPolicy Trusted
-
Run the following command to build a Puppet
module using your private PSRepository feed:
# Make sure to specify the correct parameters
PS> New-PuppetDscModule -PowerShellModuleName YourPowerShellModule
-PowerShellModuleVersion 2.2.3 -Repository YourRepository
The Puppet.Dsc
module generates to the
import
folder. Use Puppet Development Kit (PDK) to build a module tarball
and distribute it — in the same way that you distribute other private Puppet modules. For more information, see the
PDK documentation.