Hello,
Setting up the DSC pull server and the node for the first time and I am hitting an error that I couldn’t solve. Please help.
Server configuration
Server in Azure
configuration Sample_xDscWebServiceRegistration
{
param
(
[string[]]$NodeName = 'localhost',
[ValidateNotNullOrEmpty()]
[string] $certificateThumbPrint,
[Parameter(HelpMessage='This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')]
[ValidateNotNullOrEmpty()]
[string] $RegistrationKey # A guid that clients use to initiate conversation with pull server
)
Import-DSCResource -ModuleName PSDesiredStateConfiguration
Import-DSCResource -ModuleName xPSDesiredStateConfiguration
Node $NodeName
{
WindowsFeature DSCServiceFeature
{
Ensure = "Present"
Name = "DSC-Service"
}
xDscWebService PSDSCPullServer
{
Ensure = "Present"
EndpointName = "PSDSCPullServer"
Port = 443
PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer"
CertificateThumbPrint = $certificateThumbPrint
ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules"
ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration"
State = "Started"
DependsOn = "[WindowsFeature]DSCServiceFeature"
RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService"
AcceptSelfSignedCertificates = $true
UseSecurityBestPractices = $true
Enable32BitAppOnWin64 = $false
}
File RegistrationKeyFile
{
Ensure = 'Present'
Type = 'File'
DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
Contents = $RegistrationKey
}
}
}
PS C:\Program Files\WindowsPowerShell\DscService\Configuration> Get-DscConfigurationStatus
Status StartDate Type Mode RebootRequested NumberOfResources
Success 12/23/2020 9:05:38 PM Consistency PUSH False 3
Also created the testconfig.mof and the corresponding .checksum under the DSCService\Configurations folder
Client configuration
Test client machine - local desktop
Created the metamof using this configuration
[DSCLocalConfigurationManager()]
configuration PullClientConfigNames
{
Node localhost
{
Settings
{
RefreshMode = 'Pull'
RefreshFrequencyMins = 30
ConfigurationMode = 'ApplyAndAutoCorrect'
RebootNodeIfNeeded = $true
}
ConfigurationRepositoryWeb dsc-test
{
ServerURL = 'https://dsc-test.preprod.com/PSDSCPullServer.svc/'
AllowUnsecureConnection = $true
RegistrationKey = 'fc2a988a-aacf-4c6e-a388-fdd0c42338a8'
ConfigurationNames = @('testconfig')
}
}
}
PullClientConfigNames
When running the command
Set-DscLocalConfigurationManager -Path .\PullClientConfigNames -Verbose
Getting the below error message
VERBOSE: Performing the operation “Start-DscConfiguration: SendMetaConfigurationApply” on target “MSFT_DSCLocalConfigurationManager”.
VERBOSE: Perform operation ‘Invoke CimMethod’ with following parameters, ‘‘methodName’ = SendMetaConfigurationApply,‘className’ = MSFT_DSCLocalConfigurationManager,‘namespaceName’ = root/Microsoft/Windows/DesiredStateConfiguration’.
VERBOSE: An LCM method call arrived from computer desktop-HOME with user sid S-1-5-21-1893490152-1803344854-317642803-1002.
VERBOSE: [desktop-HOME]: LCM: [ Start Set ]
VERBOSE: [desktop-HOME]: LCM: [ Start Resource ] [MSFT_DSCMetaConfiguration]
VERBOSE: [desktop-HOME]: LCM: [ Start Set ] [MSFT_DSCMetaConfiguration]
VERBOSE: [desktop-HOME]: LCM: [ End Set ] [MSFT_DSCMetaConfiguration] in 0.0340 seconds.
VERBOSE: [desktop-HOME]: LCM: [ End Resource ] [MSFT_DSCMetaConfiguration]
VERBOSE: [desktop-HOME]: LCM: [ End Set ]
Registration of the Dsc Agent with the server https://dsc-test.preprod.com/PSDSCPullServer.svc/ failed. The underlying error is: The PowerShell DSC resource is not a valid Desired State Configuration resource. .
- CategoryInfo : InvalidOperation: (root/Microsoft/…gurationManager:String) , CimException
- FullyQualifiedErrorId : Pull_Registration_ManagedPluginFailure
- PSComputerName : localhost
VERBOSE: Operation ‘Invoke CimMethod’ complete.
VERBOSE: Set-DscLocalConfigurationManager finished in 0.399 seconds.
Note: I have the root cert from the pull server copied to the trusted certs on my desktop.