PlagueHO / LabBuilder

PowerShell Module for building a Hyper-V Lab environment from a simple XML configuration file.
MIT License
224 stars 39 forks source link

Bug: MEMBER_ROOTCA.DSC.PS1 leaves the system with unvalid properties #354

Open DennisL68 opened 4 years ago

DennisL68 commented 4 years ago
Verison of PowerShell: 
$PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17763  1007

PowerShell host:
Console

Operating system:
Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version, ServicePackMajorVersion, OSArchitecture, WindowsDirectory

Caption                 : Microsoft Windows Server 2019 Standard
Version                 : 10.0.17763
ServicePackMajorVersion : 0
OSArchitecture          : 64-bit
WindowsDirectory        : C:\Windows

Version of LabBuilder:
PS C:\Windows\system32> Get-Module -Name LabBuilder -ListAvailable

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.0.5.105  LabBuilder                          {Get-LabResourceModule, Initialize-LabResourceModule, Get-...

When checking the state of the DC after deployment with Get-DscConfiguration an error is returned.

PS C:\Users\administrator.LABBUILDER> Get-DscConfiguration
Get-DscConfiguration : The PowerShell DSC resource  returned results that are not valid from Get-TargetResource. The
DSConfigDN key is not a valid property in the corresponding DSC resource schema file. The results from
Get-TargetResource must be in a Hashtable format. The keys in the Hashtable must be the same as the properties in the
corresponding DSC resource schema file.
At line:1 char:1
+ Get-DscConfiguration
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidResult: (MSFT_DSCLocalConfigurationManager:root/Microsoft/...gurationManager) [Ge
   t-DscConfiguration], CimException
    + FullyQualifiedErrorId : GetOperationResultInvalidResultFormat,Get-DscConfiguration

Also, Test-DscConfiguration fails.

Test-DscConfiguration -Detailed | select -ExpandProperty ResourcesNotInDesiredState | 
select ConfigurationName,InstanceName,ResourceName

ConfigurationName InstanceName  ResourceName
----------------- ------------  ------------
MEMBER_ROOTCA     ADCSAdvConfig Script

The configuration used for the CA:

<vm name="PKI"
        template="Template Windows Server 2019 b1903 - 1GB"
        computername="PKI"
        bootorder="20">

      <dsc configname="MEMBER_ROOTCA"
           configfile="MEMBER_ROOTCA.DSC.ps1">
        <parameters>
          DomainName = 'LABBUILDER.COM'
          DomainAdminPassword = 'Password!1'
          DCName = 'DC'
          PSDscAllowDomainUser = $true
          InstallRSATTools = $true

          CACommonName = 'LABBUILDER.COM Root CA'
          CADistinguishedNameSuffix = 'DC=LABBUILDER,DC=COM'
          CRLPublicationURLs = '65:C:\Windows\system32\CertSrv\CertEnroll\%3%8%9.crl\n79:ldap:///CN=%7%8,CN=%2,CN=CDP,CN=Public Key Services,CN=Services,%6%10\n6:http://pki.labbuilder.com/CertEnroll/%3%8%9.crl'
          CACertPublicationURLs = '1:C:\Windows\system32\CertSrv\CertEnroll\%1_%3%4.crt\n2:ldap:///CN=%7,CN=AIA,CN=Public Key Services,CN=Services,%6%11\n2:http://pki.labbuilder.com/CertEnroll/%1_%3%4.crt'
          CRLPeriodUnits = 52
          CRLPeriod = 'Weeks'
          CRLOverlapUnits = 12
          CRLOverlapPeriod = 'Hours'
          ValidityPeriodUnits = 10
          ValidityPeriod = 'Years'
          AuditFilter = 127
        </parameters>
      </dsc>

      <adapters>
        <adapter name="External"
          switchname="External">
        </adapter>
        <adapter name="Private"
          switchname="Private">
            <ipv4 address="192.168.11.3"
                subnetmask="24"
                dnsserver="192.168.11.2"/>
        </adapter>
      </adapters>
    </vm>
PlagueHO commented 4 years ago

This looks like it could be a bug in the ActiveDirectoryCSDsc resource. I'll need to log it and track it over there.