Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to import full certificate chain with with Add-DbaComputerCertificate #9331

Open
bilodeauj opened this issue Apr 24, 2024 · 0 comments
Labels
feature triage required New issue that has not been reviewed by maintainers

Comments

@bilodeauj
Copy link

Summarize Functionality

When importing a certificate with the full certificate chain including the intermediate certificate authority, it would be good if the Add-DbaComputerCertificate would have an option to import all of it instead of just the server cert.

Is there a command that is similiar or close to what you are looking for?

Yes

Technical Details

When importing a certificate from let's encrypt using the the Add-DbaComputerCertificate cmdlet, it only imports the cert and not the full chain including the intermediate root cert. If I then try to assigne the cert using Set-DbaNetworkCertificate it fails to assign read permissions to the cert, and I get the following error

WARNING: Read-only permissions could not be granted to certificate, unable to determine private key path.

$CertificatePath = "C:\cert\fullchain.pfx"
$Password = Read-Host "Enter the SSL Certificate Password" -AsSecureString
Add-DbaComputerCertificate -ComputerName $ComputerName -Path $CertificatePath -SecurePassword $Password

Get-DbaComputerCertificate -ComputerName $ComputerName | Where {$_.Name -eq 'cert name'} | Set-DbaNetworkCertificate -SqlInstance $SQLInstance -RestartService

If i import the certificate using the Import-PfxCertificate cmdlet like shown below, it imports the server cert and intermediate root cert (the full chain), then when using Set-DbaNetworkCertificate i don't get the read-only permission error like i previously did.

$CertificatePath = "C:\cert\fullchain.pfx"
$Password = Read-Host "Enter the SSL Certificate Password" -AsSecureString
Import-PfxCertificate -FilePath $CertificatePath -Password $Password -CertStoreLocation 'Cert:\LocalMachine\My'
@bilodeauj bilodeauj added feature triage required New issue that has not been reviewed by maintainers labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature triage required New issue that has not been reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

1 participant