AL/New-CredentialFromEnvironmetJson.ps1
function New-CredentialFromEnvironmentJson { param ( # Source path containing environment.json [Parameter(Mandatory=$false)] [string] $SourcePath = (Get-Location) ) if ((Get-EnvironmentKeyValue -SourcePath $SourcePath -KeyName 'password') -eq '') { return $false } $Password = ConvertTo-SecureString (Get-EnvironmentKeyValue -SourcePath $SourcePath -KeyName 'password') -AsPlainText -Force return New-Object System.Management.Automation.PSCredential((Get-EnvironmentKeyValue -SourcePath $SourcePath -KeyName 'user'), $Password) } Export-ModuleMember -Function New-CredentialFromEnvironmentJson |