Hi.
I am trying to export my current Octopus Server certificate like described in How to regenerate certificates with Octopus Server and Tentacle - Octopus Deploy
I Run into the below error. Can someone point me to the reason of the below error?
PS C:\Program Files\Octopus Deploy\Octopus> .\Octopus.Server.exe export-certificate --instance OctopusServer --export-pfx=“E:\Octopus\Certs\oldcert.pfx” --pfx-password SecretPW
Checking the Octopus Master Key has been configured.
Making sure it’s safe to upgrade the database schema…
Ensuring pre-conditions for upgrading the database are satisfied…
Searching for indexes that might upset the database upgrade process…
- “PASS”: “All columns use the default collation.”
- “PASS”: “Skipping the license compliance check since the database already has the expected schema. No changes are required.”
- “PASS”: “The version of your SQL Server satisfies Octopus Server installation requirements.”
- “PASS”: “There aren’t any unexpected indexes in the database.”
Executing always run pre scripts…
Executing TSQL Database Server script ‘Script0000 - Set highest available compatibility level.sql’
Current COMPATIBILITY_LEVEL for Octopus is set to 150
Ensuring COMPATIBILITY_LEVEL for Octopus is set to 150
COMPATIBILITY_LEVEL for Octopus is already 150 or higher
Executing TSQL Database Server script ‘Script0001 - Remove Namespace Prefix From Script Names.sql’
Preparing to remove namespace prefix from script names in the [SchemaVersions] table…
Table [SchemaVersions] exists, inspecting script names…
Script names are not prefixed, nothing to do.
Always-run pre scripts “succeeded” after 029ms.
Checking database schema upgrade history…
Checking to see if database schema upgrade is required…
Database already has the expected schema. No changes are required.
Executing always run post scripts…
Executing TSQL Database Server script ‘Script0000 - Refresh Views.sql’
Refreshing view dbo.Dashboard
Refreshing view dbo.IdsInUse
Refreshing view dbo.MultiTenancyDashboard
Refreshing view dbo.Release_WithDeploymentProcess
Refreshing view dbo.RunbookSnapshot_WithRunbookProcess
Always-run post scripts “succeeded” after 038ms.
Database upgrade “succeeded” after 383ms.
Exporting certificate…
Key not valid for use in specified state.
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: Key not valid for use in specified state.
at Internal.Cryptography.Pal.StorePal.Export(X509ContentType contentType, SafePasswordHandle password)
at Internal.Cryptography.Pal.CertificatePal.Export(X509ContentType contentType, SafePasswordHandle password)
at System.Security.Cryptography.X509Certificates.X509Certificate.Export(X509ContentType contentType, String password)
at Octopus.Server.Commands.ExportCertificateCommand.Start() in ./source/Octopus.Server/Commands/ExportCertificateCommand.cs:line 58
at Octopus.Shared.Startup.AbstractCommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions) in ./source/Octopus.Shared/Startup/AbstractCommand.cs:line 100
at Octopus.Shared.Startup.OctopusProgram.Start(ICommandRuntime commandRuntime) in ./source/Octopus.Shared/Startup/OctopusProgram.cs:line 504
at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown) in ./source/Octopus.Shared/Startup/ConsoleHost.cs:line 34
at Octopus.Shared.Startup.OctopusProgram.RunHost(ICommandHost host) in ./source/Octopus.Shared/Startup/OctopusProgram.cs:line 221
at Octopus.Shared.Startup.OctopusProgram.Run() in ./source/Octopus.Shared/Startup/OctopusProgram.cs:line 167
"-------------------------------------------------------------------------------
Terminating process with exit code 100
Full error details are available in the log files at:
C:\Octopus\Logs
Kind regards
Kasper