I’m trying to replace a certificate (hooking it into the let’s encrypt flow) and I get the following exception:
The document does not define a link for 'Replace'
The code used:
$endpoint = New-Object Octopus.Client.OctopusServerEndpoint("", $OctopusApiKey)
$repository = New-Object Octopus.Client.OctopusRepository($endpoint);
$certificateToReplace = New-Object Octopus.Client.Model.CertificateResource($certName, '', '');
$certificateToReplace.Name = $certName;
$certificateData = Get-Content "C:\\Certificates\\$suffix.pfx" -Encoding Byte
$password = "";
$certDataBase64 = [System.Convert]::ToBase64String($certificateData);
$newCert = New-Object Octopus.Client.Model.CertificateResource( $certName , $certDataBase64 , $password )
$result = $repository.Certificates.Replace($certificateToReplace, $certDataBase64, $password);
Any thoughts? Browsed around in the code a bit but couldn’t figure it out.