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
Details of the scenario you tried and the problem that is occurring
Problem occurs when configuring fresh ADFS farm and trying to set 'token-signing' certificate with AdfsCertificate.
I get the error: PS0006: The IsPrimary parameter must be specified when a Token-Encryption or Token-Signing certificate is specified. But the real problem is that the certificate is not added in the first place.
Verbose logs showing the problem
Code="VMExtensionProvisioningError" Message="VM has reported a failure when processing extension 'TestDSC'. Error message: \"DSC Configuration 'CreateRootDomain' completed with error(s). Following are the first few: PowerShell DSC resource MSFT_AdfsCertificate failed to execute Set-TargetResource functionality with error message: System.InvalidOperationException: Error setting 'Token-Signing'. (CERERR002) ---> System.ArgumentException: PS0006: The IsPrimary parameter must be specified when a Token-Encryption or Token-Signing certificate is specified.
at Microsoft.IdentityServer.Management.Commands.SetCertificateCommand.DoProcessing()
at Microsoft.IdentityServer.Management.Commands.SetCertificateCommand.EndProcessingOverride()
---End of inner exception stack trace --- PowerShell DSC resource MSFT_AdfsCertificate failed to execute Set-TargetResource functionality with error message: System.InvalidOperationException: Error setting 'Token-Decrypting'. (CERERR002) ---> System.ArgumentException: PS0006: The IsPrimary parameter must be specified when a Token-Encryption or Token-Signing certificate is specified.
at Microsoft.IdentityServer.Management.Commands.SetCertificateCommand.DoProcessing()
at Microsoft.IdentityServer.Management.Commands.SetCertificateCommand.EndProcessingOverride()
---End of inner exception stack trace --- The SendConfigurationApply function did not succeed. LCM failed to start desired state configuration manually.\"
Suggested solution to the issue
Add-AdfsCertificate before setting it.
Following command produces same error as in DSC.
PS C:\Users\adminuser>Set-AdfsCertificate-CertificateType "Token-Signing"-Thumbprint $thumbprintSet-AdfsCertificate : PS0006: The IsPrimary parameter must be specified when a Token-Encryption or Token-Signing
certificate is specified.
At line:1 char:1+Set-AdfsCertificate-CertificateType "Token-Signing"-Thumbprint "7ED ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Set-AdfsCertificate], ArgumentException + FullyQualifiedErrorId : PS0006,Microsoft.IdentityServer.Management.Commands.SetCertificateCommand
Adding -IsPrimary to the command produces another error.
PS C:\Users\adminuser>Set-AdfsCertificate-CertificateType "Token-Signing"-Thumbprint $thumbprint-IsPrimary
Set-AdfsCertificate : PS0010: You must add the certificate before you can set it to be the primary certificate.
At line:1 char:1+Set-AdfsCertificate-CertificateType "Token-Signing"-Thumbprint "7ED ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Set-AdfsCertificate], ArgumentException + FullyQualifiedErrorId : PS0010,Microsoft.IdentityServer.Management.Commands.SetCertificateCommand
After adding the certificate as suggested in PS0010. It is possible to set the certificate to token-signing. So I think this is the part missing.
Hi @patrikwm, thanks for reporting this. It looks like you are right, and the AdfsCertificate resource doesn't work correctly. I'm happy to review a PR if you want to raise one to fix it?
Hi! I would love to do a PR, but I started using DSC about a week ago, so I have no experience in doing code changes in DSC modules at the moment.
When fixing this issue it would be good to have a state = present/absent or PurgeSecondaryCertificates = $True/$False
because the current Primary certificate will become secondary certificate when specifying isPrimary on a secondary certificate.
This can be done with the Remove-AdfsCertificate command.
Details of the scenario you tried and the problem that is occurring
Problem occurs when configuring fresh ADFS farm and trying to set 'token-signing' certificate with AdfsCertificate.
I get the error: PS0006: The IsPrimary parameter must be specified when a Token-Encryption or Token-Signing certificate is specified. But the real problem is that the certificate is not added in the first place.
Verbose logs showing the problem
Suggested solution to the issue
Add-AdfsCertificate before setting it.
Following command produces same error as in DSC.
Adding -IsPrimary to the command produces another error.
After adding the certificate as suggested in PS0010. It is possible to set the certificate to token-signing. So I think this is the part missing.
The only place In the code I can find the Add-AdfsCertificate is in AdfsDsc/Tests/Unit/Stubs/AdfsStub.psm1
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used
1.1.0
The text was updated successfully, but these errors were encountered: