Skip to content

Commit cefc719

Browse files
committed
Fixed handling of secure strings in profiles
1 parent 1750f82 commit cefc719

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/StorageGRID-Webscale.psm1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,15 @@ function ConvertTo-SgwConfigFile {
260260
if ($SgwConfigFile -match "credentials$") {
261261
foreach ($Config in $Configs) {
262262
if ([environment]::OSVersion.Platform -match "win") {
263-
$secure_password = ConvertTo-SecureString -String $Config.password -AsPlainText -Force | ConvertFrom-SecureString
263+
if ($Config.secure_password) {
264+
$secure_password = $Config.secure_password | ConvertFrom-SecureString
265+
}
266+
elseif ($Config.password) {
267+
$secure_password = ConvertTo-SecureString -String $Config.password -AsPlainText -Force | ConvertFrom-SecureString
268+
}
269+
else {
270+
throw "Neither password nor secure_password provided"
271+
}
264272
$Output += "[$( $Config.ProfileName )]`n"
265273
$Output += "username = $($Config.username)`n"
266274
$Output += "secure_password = $($secure_password)`n"

0 commit comments

Comments
 (0)