How to pass a release variable in a powershell script in XlRelease

29 views Asked by At

I'm trying to automate the generation of a certificate for our IIS. To accomplish this, I am using a PowerShell command to convert my Base64 private key to PFX format and download it. Since this process is automated, I need to pass the private key as a release variable in XL Release. However, I am encountering difficulties in achieving this.

I tried this but it didn't work :

>powershell -command "$certificateBase64 = $using:releaseVariables['Certificate64Base']; $decodedPrivateKey = [System.Convert]::FromBase64String($certificateBase64); $privateKeyFilePath = 'C:\test_private_key.pfx'; [System.IO.File]::WriteAllBytes($privateKeyFilePath, $decodedPrivateKey)"

quick update i tried this:

powershell -command "$certificateBase64 = '${Certificate64Base}'; $decodedPrivateKey = [System.Convert]::FromBase64String($certificateBase64); $privateKeyFilePath = 'C:\test_private_key.pfx'; [System.IO.File]::WriteAllBytes($privateKeyFilePath, $decodedPrivateKey)"

but i got :

The task could not start because the following variables could not be replaced: ${Certificate64Base}. Ensure that global and folder variables are defined, there is no circular references, password variables are only used in password fields, and other variables are only used in non-password fields.

0

There are 0 answers