Fix S360 PSAvoidUsingConvertToSecureStringWithPlainText in GetCredential.Tests.ps1

Replace ConvertTo-SecureString -AsPlainText with [System.Net.NetworkCredential]::new()
which produces an equivalent SecureString without triggering the PSSA rule.

Fixes ADO #34502919

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Travis Plunk
2026-04-08 14:26:29 -04:00
co-authored by Copilot
parent 58b00b5bb0
commit 920207f51f
@@ -97,7 +97,7 @@ Describe "Get-Credential Test" -Tag "CI" {
}
It "Get-Credential `$credential" {
#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Demo/doc/test secret.")]
$password = ConvertTo-SecureString -String "CredTest" -AsPlainText -Force
$password = [System.Net.NetworkCredential]::new('', 'CredTest').SecurePassword
$credential = [pscredential]::new("John", $password)
$cred = Get-Credential $credential