Expand Minimize

SPC029105: Do not use plain text for passwords

Using plain text passwords directly compromises your system security

CheckId SPC029105
TypeName DoNotUsePlainTextPasswords
Severity CriticalError
Type PoShFile

Bad Practice

function Verb-Noun
{
  [CmdletBinding()]
  [Alias()]
  [OutputType([int])]
  Param
  (
    # Param1 help description
    [Parameter(Mandatory=$true,
           ValueFromPipelineByPropertyName=$true,
           Position=0)]
    $Param1,
    # Param2 help description
    [int]
    $Param2,
    [SecureString]
    $Password,
    [System.Security.SecureString]
    $Pass,
    [SecureString[]]
    $Passwords,
    $Passphrases,
    $Passwordparam
  )
}

function TestFunction($password, [System.Security.SecureString[]]passphrases, [String]$passThru){
}
Good Practice
  function Test-Script
  {
      [CmdletBinding()]
      [Alias()]
      [OutputType([Int])]
      Param
      (
          # Param1 help description
          [Parameter(Mandatory=$true,
                     ValueFromPipelineByPropertyName=$true,
                     Position=0)]
          $Param1,
          # Param2 help description
          [int]
          $Param2,
          [SecureString]
          $Password,
          [System.Security.SecureString]
          $Pass,
    [SecureString[]]
          $Passwords,
          [SecureString]
        $Passphrases,
            [SecureString]
        $PasswordParam,
            [string]
            $PassThru
          )
  }
  function TestFunction([SecureString]$Password, [System.Security.SecureString[]]$Passphrases, [SecureString[]]$passes){
  }

Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.