[resolved] Unable to compile any DSC Configurations in Azure Automation which use PSDscResrouce

Robbie Crash 101 Reputation points
2020-11-28T08:41:23.01+00:00

Any DSC configurations which I try to run which rely on the PSDscResources module fail with the following error. This happens if I use the default Azure 2.9.0 version, or the updated 2.12.0 version. This happens with code that compiled properly on November 26th, and with new code. Removing the PsDscResources related code, everything compiles properly:

Exception calling "NewScriptBlock" with "1" argument(s): "At line:4 char:5 + Import-DscResource -ModuleName PSDscResources + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Exception parsing MOF file 'C:\Modules\Global\PSDscResources\DSCResources\MSFT_WindowsPackageCab\MSFT_WindowsPackageCab.Schema.mof':The given key was not present in the dictionary.." (At line:44 char:5 + Import-DscResource -ModuleName PSDscResources + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Exception parsing MOF file 'C:\Modules\Global\PSDscResources\DSCResources\MSFT_WindowsPackageCab\MSFT_WindowsPackageCab.Schema.mof':The given key was not present in the dictionary..)

The DSC Configuration is simple:

    Configuration Test 
    {
        Import-DscResource -ModuleName "NetworkingDSC"
        Import-DscResource -ModuleName "PSDscResources"

        node localhost {
                WindowsFeature FeatureToRemove {
                    Ensure          =   "Absent"
                    Name            =   "FS-SMB1"
                }

                NetIPInterface DisableDHCPPrimaryNIC {
                    InterfaceAlias    =   "Ethernet 2"
                    AddressFamily     =   "IPv4"
                    DHCP              =   "Disabled"
                }
        }
    }
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,176 questions
Windows Server Management
Windows Server Management
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Management: The act or process of organizing, handling, directing or controlling something.
424 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful