Issue comes from Azure/azure-powershell#12264. Below simplified code is hanging. If I use other cmdlet instead of ConvertTo-SecureString, it seems no problem.
Steps to reproduce
[string] $kvName = "<your-kv-name>"
$block = {
param (
[string]
$kvName,
[string]
$secretName,
[string]
$secretValue,
$dummy
)
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
Write-Host "Setting secret..."
ConvertTo-SecureString -String secretValue -AsPlainText -Force
Write-Host ("Elapsed time: {0}" -f $stopwatch.Elapsed.ToString())
}
$secretValue = "TopSecret!"
# Uncomment the following line to fix the issue
#$dummy = ConvertTo-SecureString -String secretValue -AsPlainText -Force
Start-Job -ScriptBlock $block -ArgumentList @($kvName, "SecretName1", $secretValue, $dummy) | Receive-Job -Wait -AutoRemoveJob
Expected behavior
Actual behavior
Environment data
Issue comes from Azure/azure-powershell#12264. Below simplified code is hanging. If I use other cmdlet instead of
ConvertTo-SecureString, it seems no problem.Steps to reproduce
Expected behavior
Actual behavior
Environment data