Skip to main content
powershell/PSAvoidUsingUsernameAndPasswordParams is a PSScriptAnalyzer diagnostic emitted by tally for PowerShell snippets embedded in Dockerfiles.

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

Correct code

Source

This rule documentation is adapted from Microsoft’s PSScriptAnalyzer documentation for AvoidUsingUsernameAndPasswordParams, licensed under CC BY 4.0.