Skip to content

Commit

Permalink
Merge pull request #37 from Akaizoku/36-terminatingerrorconvertfrom-s…
Browse files Browse the repository at this point in the history
…ecurestring-a-parameter-cannot-be-found-that-matches-parameter-name-asplaintext

36 terminatingerrorconvertfrom securestring a parameter cannot be found that matches parameter name asplaintext
  • Loading branch information
Akaizoku authored Nov 20, 2024
2 parents 4e63db5 + ec73ecb commit d894a81
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 21 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to the [`alteryx-deploy`](https://github.com/Akaizoku/altery
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.1](https://github.com/Akaizoku/alteryx-deploy/releases/2.0.1) - 2024-10-20

Fix key encryption and decryption issues.

### Fixed

- Fixed an issue with license API token and keys encryption during setup [[#36](https://github.com/Akaizoku/alteryx-deploy/issues/36)]
- Fixed an issue with license API token and keys decryption during download [[#36](https://github.com/Akaizoku/alteryx-deploy/issues/36)]
- Fixed an issue when license keys decryption during activation [[#36](https://github.com/Akaizoku/alteryx-deploy/issues/36)]
- Fixed an issue when license keys decryption during deactivation [[#36](https://github.com/Akaizoku/alteryx-deploy/issues/36)]
- Fixed an issue when attempting to redownload an existing major version without any patch available

## [2.0.0](https://github.com/Akaizoku/alteryx-deploy/releases/2.0.0) - 2024-10-08

Complete revamp to provide support for new installers (2022.3+), license portal API, as well as guardrails and usefull error handling.
Expand Down
2 changes: 1 addition & 1 deletion Deploy-Alteryx.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Requires -Version 5.0
#Requires -Version 5.1
#Requires -RunAsAdministrator

<#
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@
Download the latest stable version from the [`alteryx-deploy`](https://github.com/Akaizoku/alteryx-deploy) GitHub repository.

```powershell
curl --remote-name --remote-header-name "https://github.com/Akaizoku/alteryx-deploy/releases/download/2.0.0/alteryx-deploy-v2.0.0.zip"
curl --remote-name --remote-header-name "https://github.com/Akaizoku/alteryx-deploy/releases/download/2.0.1/alteryx-deploy-v2.0.1.zip"
```

Alternatively, if you do not wish to install the PowerShell modules required as dependencies, you can download the portable version.

```powershell
curl --remote-name --remote-header-name "https://github.com/Akaizoku/alteryx-deploy/releases/download/2.0.0/alteryx-deploy-v2.0.0-portable.zip"
curl --remote-name --remote-header-name "https://github.com/Akaizoku/alteryx-deploy/releases/download/2.0.1/alteryx-deploy-v2.0.1-portable.zip"
```

### Configuration
Expand Down Expand Up @@ -563,6 +563,7 @@ This module depends on the usage of functions provided by two PowerShell modules

1. PowerShell Tool Kit ([PSTK]) module (version 1.2.6);
2. Alteryx PowerShell ([PSAYX]) module (version 1.1.1).
2. Alteryx PowerShell ([PSAYX]) module (version 1.1.1).

## Compatibility

Expand All @@ -576,7 +577,8 @@ Only the first version supported is listed. Later releases should also be compat
| [1.1.0] | [2021.3] | 5.0 | 1.2.5 | 1.0.1 |
| [1.1.1] | [2021.3] | 5.0 | 1.2.5 | 1.0.1 |
| [1.1.2] | [2021.3] | 5.0 | 1.2.5 | 1.0.1 |
| [2.0.0] | [2024.1] | 5.0 | 1.2.6 | 1.1.1 |
| [2.0.0] | [2024.1] | 5.1 | 1.2.6 | 1.1.1 |
| [2.0.1] | [2024.2] | 5.1 | 1.2.6 | 1.1.1 |

## Known issues

Expand Down Expand Up @@ -611,4 +613,5 @@ If this occurs, simply run the command [`Stop-Transcript`](https://learn.microso
[2.0.0]:https://github.com/Akaizoku/alteryx-deploy/releases/2.0.0
[2021.3]:https://help.alteryx.com/release-notes/server/server-20213-release-notes
[2024.1]:https://help.alteryx.com/release-notes/en/release-notes/server-release-notes/server-2024-1-release-notes.html
[2024.2]:https://help.alteryx.com/release-notes/en/release-notes/server-release-notes/server-2024-2-release-notes.html
[whitelist.alteryx.com]:(whitelist.alteryx.com)
2 changes: 1 addition & 1 deletion conf/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ServerAdminAPI = server.key
# Installation language
Language = English
# Version
Version = 2024.1.1.136
Version = 2024.2.1.14
# Service name
ServiceName = AlteryxService
# InstallAware log
Expand Down
5 changes: 3 additions & 2 deletions powershell/Invoke-ActivateAlteryx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function Invoke-ActivateAlteryx {
File name: Invoke-ActivateAlteryx.ps1
Author: Florian Carrier
Creation date: 2021-07-05
Last modified: 2024-10-08
Last modified: 2024-11-20
.LINK
https://www.powershellgallery.com/packages/PSAYX
Expand Down Expand Up @@ -79,7 +79,8 @@ function Invoke-ActivateAlteryx {
$ActivateProcess = Update-ProcessObject -ProcessObject $ActivateProcess -Status "Failed" -ErrorCount 1 -ExitCode 1
return $ActivateProcess
}
$Properties.LicenseKey = (ConvertFrom-SecureString -SecureString (ConvertTo-SecureString -String (Get-Content -Path $LicenseFilePath)) -AsPlainText) -split '[ ,]+'
# Fetch and decrypt license keys
$Properties.LicenseKey = ([System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR((ConvertTo-SecureString -String (Get-Content -Path $LicenseFilePath))))) -split '[ ,]+'
}
Write-Log -Type "DEBUG" -Message $Properties.LicenseKey
# Count keys
Expand Down
5 changes: 3 additions & 2 deletions powershell/Invoke-DeactivateAlteryx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function Invoke-DeactivateAlteryx {
File name: Invoke-DeactivateAlteryx.ps1
Author: Florian Carrier
Creation date: 2021-11-20
Last modified: 2024-10-08
Last modified: 2024-11-20
.LINK
https://www.powershellgallery.com/packages/PSAYX
Expand Down Expand Up @@ -106,7 +106,8 @@ function Invoke-DeactivateAlteryx {
$DeactivateProcess = Update-ProcessObject -ProcessObject $DeactivateProcess -Status "Failed" -ErrorCount 1 -ExitCode 1
return $DeactivateProcess
} else {
$Properties.LicenseKey = (ConvertFrom-SecureString -SecureString (ConvertTo-SecureString -String (Get-Content -Path $LicenseFilePath)) -AsPlainText) -split '[ ,]+'
# Fetch and decrypt license keys
$Properties.LicenseKey = ([System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR((ConvertTo-SecureString -String (Get-Content -Path $LicenseFilePath))))) -split '[ ,]+'
}
}
Write-Log -Type "DEBUG" -Message $Properties.LicenseKey
Expand Down
16 changes: 10 additions & 6 deletions powershell/Invoke-DownloadAlteryx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Invoke-DownloadAlteryx {
File name: Invoke-DownloadAlteryx.ps1
Author: Florian Carrier
Creation date: 2024-09-04
Last modified: 2024-10-08
Last modified: 2024-11-20
#>
[CmdletBinding (
SupportsShouldProcess = $true
Expand Down Expand Up @@ -55,7 +55,7 @@ function Invoke-DownloadAlteryx {
$RegistryKey = "HKLM:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SRC\Alteryx"
# License API refresh token
$LicenseAPIPath = Join-Path -Path $Properties.ResDirectory -ChildPath $Properties.LicenseAPIFile
$RefreshToken = (ConvertFrom-SecureString -SecureString (ConvertTo-SecureString -String (Get-Content -Path $LicenseAPIPath)) -AsPlainText) -replace "`r|`n", ""
$RefreshToken = ([System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR((ConvertTo-SecureString -String (Get-Content -Path $LicenseAPIPath))))) -replace "`r|`n", ""
# Placeholder
$Skip = $false
}
Expand All @@ -68,7 +68,7 @@ function Invoke-DownloadAlteryx {
if ($null -eq $RefreshToken) {
Write-Log -Type "ERROR" -Message "The Alteryx license portal API refresh token has not been configured"
if (-Not $Unattended) {
$RefreshToken = Read-Host -Prompt "Enter your Alteryx license portal API refresh token"
$RefreshToken = (Read-Host -Prompt "Enter your Alteryx license portal API refresh token").Trim()
} else {
Write-Log -Type "ERROR" -Message "Download process cannot proceed"
$DownloadProcess = Update-ProcessObject -ProcessObject $DownloadProcess -Status "Failed" -ErrorCount 1 -ExitCode 1
Expand Down Expand Up @@ -144,7 +144,7 @@ function Invoke-DownloadAlteryx {
"Server" = $ProductID
# "PredictiveTools" = "Predictive Tools" # Included within Server
"IntelligenceSuite" = "Alteryx Intelligence Suite"
# "DataPackages" = "Data Packages" #
# "DataPackages" = "Data Packages" # ! Not yet supported
}
foreach ($Product in $Products.GetEnumerator()) {
if ($InstallationProperties.$($Product.Key) -eq $true) {
Expand All @@ -156,8 +156,12 @@ function Invoke-DownloadAlteryx {
# Check upgrade step
if (Compare-Version -Version $TargetVersion -Operator "eq" -Reference $MajorVersion) {
# If minor or patch upgrade, download patch
$Release = Get-AlteryxLatestRelease -AccountID $Properties.LicenseAccountID -Token $AccessToken -ProductID $ProductID -Version $TargetVersion -Patch
$FormattedVersion = "patch version"
$PatchRelease = Get-AlteryxLatestRelease -AccountID $Properties.LicenseAccountID -Token $AccessToken -ProductID $ProductID -Version $TargetVersion -Patch
if ($null -ne $PatchRelease) {
# Overwrite default release
$Release = $PatchRelease
$FormattedVersion = "patch version"
}
}
} else {
# Fetch latest release for add-ons
Expand Down
11 changes: 5 additions & 6 deletions powershell/Invoke-SetupScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Invoke-SetupScript {
File name: Invoke-SetupScript.ps1
Author: Florian Carrier
Creation date: 2022-05-03
Last modified: 2024-10-08
Last modified: 2024-11-20
#>
[CmdletBinding (
SupportsShouldProcess = $true
Expand Down Expand Up @@ -130,10 +130,9 @@ function Invoke-SetupScript {
$ConfigureLicenseAPI = $true
if (Test-Path -Path $LicenseAPIPath) {
try {
$RefreshAPIToken = ConvertFrom-SecureString -SecureString (ConvertTo-SecureString -String (Get-Content -Path $LicenseAPIPath)) -AsPlainText
$RefreshAPIToken = ConvertFrom-SecureString -SecureString (ConvertTo-SecureString -String (Get-Content -Path $LicenseAPIPath))
if ($RefreshAPIToken -notin ($null, "")) {
Write-Log -Type "WARN" -Message "License Portal API refresh token has already been configured"
Write-Log -Type "DEBUG" -Message $RefreshAPIToken
$ConfigureLicenseAPI = Confirm-Prompt -Prompt "Do you want to reconfigure the License Portal API refresh token?"
}
}
Expand All @@ -143,9 +142,9 @@ function Invoke-SetupScript {
}
}
if ($ConfigureLicenseAPI) {
# Input in plain text to trim and prevent issues
$LicenseAPIToken = (Read-Host -Prompt $LicenseAPIPrompt).Trim()
$EncryptedLicenseAPIToken = ConvertFrom-SecureString -SecureString (ConvertTo-SecureString -String $LicenseAPIToken.ToString() -AsPlainText -Force)
# Write-Log -Type "DEBUG" -Message $EncryptedLicenseAPIToken
Write-Log -Type "DEBUG" -Message $LicenseAPIPath
Set-Content -Path $LicenseAPIPath -Value $EncryptedLicenseAPIToken -NoNewline -Force
if (Test-Path -Path $LicenseAPIPath) {
Expand Down Expand Up @@ -238,14 +237,14 @@ function Invoke-SetupScript {
$LicenseFilePath = Join-Path -Path "$PSScriptRoot/.." -ChildPath "$($Properties.ResDirectory)/$($Properties.LicenseFile)"
$ConfigureLicenseFile = $true
if (Test-Path -Path $LicenseFilePath) {
$LicenseKeys = ConvertFrom-SecureString -SecureString (ConvertTo-SecureString -String (Get-Content -Path $LicenseFilePath)) -AsPlainText
$LicenseKeys = ConvertFrom-SecureString -SecureString (ConvertTo-SecureString -String (Get-Content -Path $LicenseFilePath))
if ($LicenseKeys -notin ($null, "")) {
Write-Log -Type "WARN" -Message "License keys have already been configured"
Write-Log -Type "DEBUG" -Message $LicenseKeys
$ConfigureLicenseFile = Confirm-Prompt -Prompt "Do you want to overwrite the existing license keys?"
}
}
if ($ConfigureLicenseFile) {
# Input in plain text to trim and prevent issues
$LicenseKeys = (Read-Host -Prompt "Enter Alteryx license key(s)").Trim()
try {
$EncryptedLicenseKeys = ConvertFrom-SecureString -SecureString (ConvertTo-SecureString -String $LicenseKeys -AsPlainText -Force)
Expand Down
3 changes: 3 additions & 0 deletions powershell/Repair-Alteryx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ function Repair-Alteryx {
Author: Florian Carrier
Creation date: 2022-04-22
Last modified: 2022-04-27
.LINK
https://knowledge.alteryx.com/index/s/article/How-To-and-When-to-run-a-manual-reindex
#>
[CmdletBinding (
SupportsShouldProcess = $true
Expand Down

0 comments on commit d894a81

Please sign in to comment.