> ## 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/PSUsePSCredentialType

> Use PSCredential type.

`powershell/PSUsePSCredentialType` is a PSScriptAnalyzer diagnostic emitted by tally for PowerShell snippets embedded in Dockerfiles.

| Property | Value |
| - | - |
| Severity | Warning |
| Category | PSScriptAnalyzer |
| Auto-fix | No |

## Description

If the cmdlet or function has a **Credential** parameter, the parameter must accept the
**PSCredential** type.

## How

Change the **Credential** parameter's type to be **PSCredential**.

## Examples

### Problematic code

```powershell theme={null}
function Credential([String]$Credential)
{
    ...
}
```

### Correct code

```powershell theme={null}
function Credential([PSCredential]$Credential)
{
    ...
}
```

## Source

This rule documentation is adapted from Microsoft's PSScriptAnalyzer documentation for
[UsePSCredentialType](https://github.com/MicrosoftDocs/PowerShell-Docs-Modules/blob/main/reference/docs-conceptual/PSScriptAnalyzer/Rules/UsePSCredentialType.md),
licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).


## Related topics

- [powershell/PSUseCompatibleTypes](/rules/powershell/PSUseCompatibleTypes.md)
- [powershell/PSUseOutputTypeCorrectly](/rules/powershell/PSUseOutputTypeCorrectly.md)
- [powershell/PSAvoidUsingUsernameAndPasswordParams](/rules/powershell/PSAvoidUsingUsernameAndPasswordParams.md)
- [tally/require-secret-mounts](/rules/tally/require-secret-mounts.md)
- [powershell/PSUseConstrainedLanguageMode](/rules/powershell/PSUseConstrainedLanguageMode.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.