Set-SBCertificate does not find a valid certificate
I'm trying to apply pre-generated (from Active Directory CA) certificates to our On-Premise Service Bus environment via powershell. Below are the scripts that I am running:
$cert = Get-ChildItem Cert:\LocalMachine\Root | ?{$_.FriendlyName -eq '[CERTS FRIENDLY NAME]'}
Set-SBCertificate -EncryptionCertificateThumbprint $cert.Thumbprint -FarmCertificateThumbprint $cert.Thumbprint`
Below is the error I am getting:
Set-SBCertificate: Unable to validate the argument in the "EncryptionCertificateThumbprint" parameter. A valid certificate with thumbprint xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx not found On line: 1 char: 52 + Set-SBCertificate -EncryptionCertificateThumbprint $ encryptCert.Thumbprint -Farm ... + ~~~~~~~~~~~~~~~~~~~~~ ~~~ + CategoryInfo: InvalidData: (:) [Set-SBCertificate], ParameterBindingValidationException + FullyQualifiedErrorId: ParameterArgumentValidationError, Microsoft.ServiceBus.Commands.SetSBFarmCertificate
List of things I did to fix this issue:
- Checked that $ cert actually contains a certificate.
- Verify that the certificate is actually installed on the server by going to mmc.exe and looking at "Certificates (Local Computer) / Trusted Root Certification Authorities / Certificates".
- An attempt was made to use two delta certificates for farm and encryption.
Does anyone have any ideas on this issue? Or perhaps you know where the powershell module is trying to look for certificates? Any help is greatly appreciated!
source to share
For me the problem was that the entire certificate was removed (not sure how). I open Regedit and remove the entire ServiceBus from HKey_current_User and Hkey_Local_Machine, and internally Microsoft deletes the entire Service Bus folder.
Then from the control panel Add Remove install unstall Service Bus.
Reinstall Service Bus.
source to share