Docker SQL Server 2017 container @latest. Using master
database.
The error I am facing is the following:
[S00019][15208] The certificate, asymmetric key, or private key file is not valid or does not exist; or you do not have permissions for it.
The closest thing I have found to this exact question is this issue on Stackoverflow. However the answer doesn't work for me. This question has a similar answer.
I have also tried the instructions here, and here.
So going through the parts of the error:
- I have recreated the files twice, so I don't think it's the "invalid" part. And it's obviously not the "does not exist" part (if I put in the wrong password, it tells me it's the wrong password).
- I have backed up and restored the SMK and Master Key without issue, so I don't think it's the permissions issue. The files have the exact same permissions.
I can't get the certificate to restore no matter what I try. I have searched the GitHub issues to no avail so I don't think it's a bug. I must be doing something wrong.
Relevant code:
--on Prod
BACKUP CERTIFICATE sqlserver_backup_cert
TO FILE = '/var/opt/mssql/certs/sqlserver_backup_cert.cer'
WITH PRIVATE KEY (
FILE = '/var/opt/mssql/certs/sqlserver_backup_cert.key',
ENCRYPTION BY PASSWORD = 'foobar'
)
--on Test
CREATE CERTIFICATE sqlserver_backup_cert
FROM FILE = '/var/opt/mssql/certs/sqlserver_backup_cert.crt'
WITH PRIVATE KEY (
FILE = '/var/opt/mssql/certs/sqlserver_backup_cert.key',
DECRYPTION BY PASSWORD = 'foobar'
)
It's noteworthy that /var/opt/mssql/certs
is a Docker volume. However I have also tried creating my own directory inside the container and using docker cp
. No change.