Skip to content

ConvertTo-SecureString leds hanging #13315

@dingmeng-xue

Description

@dingmeng-xue

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


Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions