3

I'm trying to write a DSC configuration for an Azure VM that I am creating using Resource Manager. I want to use xRemoteFile, so I try to import the xPSDesiredStateConfiguration module, but when I deploy it is not found.

I searched the web, and learned that I need to install the xPSDesiredStateConfiguration module before I deploy. How do I do that when I just created the VM on Azure?

Start of configuration file:

Configuration Main
{
Param ( [string] $nodeName )

Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -Name MSFT_xRemoteFile -ModuleName xPSDesiredStateConfiguration

The error message:

08:56:12 - [ERROR] + Import-DscResource -Name MSFT_xRemoteFile -ModuleName xPSDesiredState ...
08:56:12 - [ERROR] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
08:56:12 - [ERROR] The DSC engine could not load the module 'xPSDesiredStateConfiguration'. It 
08:56:12 - [ERROR] was not found on the system.".

1 Answers1

2

If you create the zip file for the DSC extension using the Publish-AzureVMDscConfiguration cmdlet and you run that cmdlet on a machine that has the xPSDesiredStateConfiguration resource in the PSModulePath, the cmdlet will pick up that resource and stuff it into the zip file for you - then when the DSC extension runs on the VM it will pull the resource from your zip and install it.

If you have the xPSDesiredStateConfiguration somewhere other than the PSModulePath, use the -AdditionalPath parameter on the cmdlet to point to wherever that resource is...

bmoore-msft
  • 8,376
  • 20
  • 22