Documentation Index
Fetch the complete documentation index at: https://tally.wharflab.com/llms.txt
Use this file to discover all available pages before exploring further.
powershell/PSAvoidUsingUsernameAndPasswordParams is a PSScriptAnalyzer diagnostic emitted by tally for PowerShell snippets embedded in Dockerfiles.
| Property | Value |
|---|
| Severity | Error |
| Category | PSScriptAnalyzer |
| Auto-fix | No |
Description
To standardize command parameters, credentials should be accepted as objects of type
PSCredential. Functions should not make use of username or password parameters.
How
Change the parameter to type PSCredential.
Examples
Problematic code
function Test-Script
{
[CmdletBinding()]
Param
(
[String]
$Username,
[SecureString]
$Password
)
...
}
Correct code
function Test-Script
{
[CmdletBinding()]
Param
(
[PSCredential]
$Credential
)
...
}
Source
This rule documentation is adapted from Microsoft’s PSScriptAnalyzer documentation for
AvoidUsingUsernameAndPasswordParams,
licensed under CC BY 4.0.