Docker SQL Server 2017 container @latest. Using
The error I am facing is the following:
[S00019] The certificate, asymmetric key, or private key file is not valid or does not exist; or you do not have permissions for it.
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.
--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.