diff --git a/src/Blockchain/custom/New-AzBlockchainMember.ps1 b/src/Blockchain/custom/New-AzBlockchainMember.ps1 index 5845275741ec..0d4b5f739e46 100644 --- a/src/Blockchain/custom/New-AzBlockchainMember.ps1 +++ b/src/Blockchain/custom/New-AzBlockchainMember.ps1 @@ -184,12 +184,12 @@ param( process { try { if ($PSBoundParameters.ContainsKey('Password')) { - $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['Password'])) + $psTxt = . "$PSScriptRoot/../utils/Unprotect-SecureString.ps1" $PSBoundParameters['Password'] $null = $PSBoundParameters.Remove('Password') $PSBoundParameters.Add('Password', $psTxt) } if ($PSBoundParameters.ContainsKey('ConsortiumManagementAccountPassword')) { - $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['ConsortiumManagementAccountPassword'])) + $psTxt = . "$PSScriptRoot/../utils/Unprotect-SecureString.ps1" $PSBoundParameters['ConsortiumManagementAccountPassword'] $null = $PSBoundParameters.Remove('ConsortiumManagementAccountPassword') $PSBoundParameters.Add('ConsortiumManagementAccountPassword', $psTxt) } diff --git a/src/Blockchain/custom/New-AzBlockchainTransactionNode.ps1 b/src/Blockchain/custom/New-AzBlockchainTransactionNode.ps1 index b0fef07d39d5..e8ba50cebedb 100644 --- a/src/Blockchain/custom/New-AzBlockchainTransactionNode.ps1 +++ b/src/Blockchain/custom/New-AzBlockchainTransactionNode.ps1 @@ -135,7 +135,7 @@ param( process { try { if ($PSBoundParameters.ContainsKey('Password')) { - $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['Password'])) + $psTxt = . "$PSScriptRoot/../utils/Unprotect-SecureString.ps1" $PSBoundParameters['Password'] $PSBoundParameters.Remove('Password') $PSBoundParameters.Add('Password', $psTxt) } diff --git a/src/Blockchain/custom/Update-AzBlockchainMember.ps1 b/src/Blockchain/custom/Update-AzBlockchainMember.ps1 index 63d29ab41e69..58a1e491ec58 100644 --- a/src/Blockchain/custom/Update-AzBlockchainMember.ps1 +++ b/src/Blockchain/custom/Update-AzBlockchainMember.ps1 @@ -141,12 +141,12 @@ param( process { try { if ($PSBoundParameters.ContainsKey('Password')) { - $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['Password'])) + $psTxt = . "$PSScriptRoot/../utils/Unprotect-SecureString.ps1" $PSBoundParameters['Password'] $PSBoundParameters.Remove('Password') $PSBoundParameters.Add('Password', $psTxt) } if ($PSBoundParameters.ContainsKey('ConsortiumManagementAccountPassword')) { - $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['ConsortiumManagementAccountPassword'])) + $psTxt = . "$PSScriptRoot/../utils/Unprotect-SecureString.ps1" $PSBoundParameters['ConsortiumManagementAccountPassword'] $PSBoundParameters.Remove('ConsortiumManagementAccountPassword') $PSBoundParameters.Add('ConsortiumManagementAccountPassword', $psTxt) } diff --git a/src/Blockchain/custom/Update-AzBlockchainTransactionNode.ps1 b/src/Blockchain/custom/Update-AzBlockchainTransactionNode.ps1 index 50dcb18f7493..4520f593ff71 100644 --- a/src/Blockchain/custom/Update-AzBlockchainTransactionNode.ps1 +++ b/src/Blockchain/custom/Update-AzBlockchainTransactionNode.ps1 @@ -133,7 +133,7 @@ param( process { try { if ($PSBoundParameters.ContainsKey('Password')) { - $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['Password'])) + $psTxt = . "$PSScriptRoot/../utils/Unprotect-SecureString.ps1" $PSBoundParameters['Password'] $PSBoundParameters.Remove('Password') $PSBoundParameters.Add('Password', $psTxt) }