Posh ACME and Dynu API

Hello,

I am trying to create a certificate for Dynu using API for validation, I have the below Powershell script:

$hostname = "domain.test.com" #The domain is from Dynu
$contactemail = "email@email.com"

$pArgs = @{DynuClientID = 'abcd';DynuSecretSecure = '1234'}

New-PACertificate $hostname -AcceptTOS -Contact $contactemail -Plugin Dynu -PluginArgs $pArgs -verbose -Force -directory LE_STAGE

When running I am getting the below error:

Submit-ChallengeValidation : Cannot process argument transformation on parameter 'DynuSecretSecure'. Cannot convert the "1234" value of type "System.String" to type "System.Security.SecureString"

I have tried few modifications but still the same error, any idea.

See the docs here:Dynu - Posh-ACME

Secure Strings are not normal strings, they are a protected-in-memory form of string storage. They have to be created as a SecureString object. It's possible to create a new secure string using a standard string. ConvertTo-SecureString (Microsoft.PowerShell.Security) - PowerShell | Microsoft Learn

E.g.

$hostname = "domain.test.com" #The domain is from Dynu
$contactemail = "email@email.com"

$pArgs = @{DynuClientID = 'abcd';DynuSecretSecure = ConvertTo-SecureString "P@ssW0rD!" -AsPlainText -Force}

New-PACertificate $hostname -AcceptTOS -Contact $contactemail -Plugin Dynu -PluginArgs $pArgs -verbose -Force -directory LE_STAGE
5 Likes

Thank you @webprofusion it works.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.