AvoidUsingUsernameAndPasswordParams
Severity Level: Error
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.
Example
Wrong
function Test-Script
{
[CmdletBinding()]
Param
(
[String]
$Username,
[SecureString]
$Password
)
...
}
Correct
function Test-Script
{
[CmdletBinding()]
Param
(
[PSCredential]
$Credential
)
...
}
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for