You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DSC_CertReq failed to execute Set-TargetResource functionality with error message: Cannot add type. The type name 'Source.NativeMethods' already exists
#270
Open
heinejeppesen opened this issue
Nov 18, 2022
· 0 comments
I'm trying to upgrade our dev environments to Windows Server 2022 and I need to get certificate from a new WS2022 based PKI.
Deployment is through Azure DevOps pipeline and Azure Automation DSC on Azure VMs.
The error comes every time the pipeline runs, deploying from scratch.
When looking at the DSC State in Azure Automation, the state becomes compliant at the second run, so almost immediately after pipeline has completed.
I can't force the error again, by testing manually, so I can't trigger the error once the initial deployment has succeeded.
Log info is what I get returned from AZ CLI through the pipeline.
Everything works, but for some reason the DSC fails the initial runs but succeeds at second run.
Verbose logs
PowerShell DSC resource DSC_CertReq failed to execute Set-TargetResource functionality with error message: Cannot add type. The type name 'Source.NativeMethods' already exists
DSC configuration
#Check if a reboot is required before requesting certificates
PendingReboot BeforeCertReq {
Name ="BeforeCertReq"
DependsOn ='[Script]ConfigureSendConnector'
}
##Get Exchange Certificate
CertReq SSLCert {
Subject ="mail.$($domainName)"
CAType ="Enterprise"
KeyLength ='2048'
Exportable =$true
CertificateTemplate ="$($environment)LabWebServer"
SubjectAltName ="dns=autodiscover.$($domainName)&dns=smtp.$($domainName)&dns=ews.$($domainName)"
AutoRenew =$true
FriendlyName ="mail.$($domainName)"
Credential =$domainAdminCredentialNetBios
DependsOn ="[PendingReboot]BeforeCertReq"
}
Suggested solution
N/A
Operating system the target node is running
Server 2022 (unpatched at the failure time)
PowerShell version and build the target node is running
5.1 (Server 2022 built-in)
CertificateDsc version
5.1.0
The text was updated successfully, but these errors were encountered:
Problem description
I'm trying to upgrade our dev environments to Windows Server 2022 and I need to get certificate from a new WS2022 based PKI.
Deployment is through Azure DevOps pipeline and Azure Automation DSC on Azure VMs.
The error comes every time the pipeline runs, deploying from scratch.
When looking at the DSC State in Azure Automation, the state becomes compliant at the second run, so almost immediately after pipeline has completed.
I can't force the error again, by testing manually, so I can't trigger the error once the initial deployment has succeeded.
Log info is what I get returned from AZ CLI through the pipeline.
Everything works, but for some reason the DSC fails the initial runs but succeeds at second run.
Verbose logs
DSC configuration
Suggested solution
N/A
Operating system the target node is running
PowerShell version and build the target node is running
CertificateDsc version
The text was updated successfully, but these errors were encountered: