Closed 0x7FFFFFFFFFFFFFFF closed 4 months ago
Looking at the code of Restore-DbaDbCertificate
, the name of the certificate will be extracted from the filename - but only if you restore to the same instance where you took the backup.
Please try to change the filenames and replace the source instance name with the target instance name. Then it should work.
Will close this now, but can reopen if needed.
Verified issue does not already exist?
I have searched and found no existing issue
What error did you receive?
Steps to Reproduce
I encountered an issue when using the
Backup-DbaDbCertificate
andRestore-DbaDbCertificate
functions from thedbatools
module to backup and restore certificates on SQL Server instances.Steps to reproduce:
mn-cls-06w.test1.mydomain.com
, I executed the following commands to backup two certificates:inst2
, I executed the following command to restore the first certificate:The first certificate was restored successfully, but the certificate name was set to 06w.test1.mydomain.com.
I received the following error:
Please confirm that you are running the most recent version of dbatools
Other details or mentions
I think the problem is that we cannot specify an exact file name when backing up a certificate, and it's very hard for the restore certificate command to correctly parse the correct certificate name from the certificate file name (it's also hard for us). If we can specify a certificate file name when backing up, then we know how to parse the certificate name from it, so that we can pass the certificate name to the
Name
parameter of theRestore-DbaDbCertificate
function. Alternatively, if the dbatools module is smart enough, it can mark the certificate name in the file name, likemn-cls-06w.test1.mydomain.com-master-[[[cde_efg_20230314]]].cer
, so that we knowcde_efg_20230314
is the certificate name.What PowerShell host was used when producing this error
Windows PowerShell (powershell.exe)
PowerShell Host Version
SQL Server Edition and Build number
.NET Framework Version