New-TfsCredential
Provides credentials to use when you connect to a Team Foundation Server or Azure DevOps organization.
Table of Contents
Syntax
Cached credentials
New-TfsCredential
[-Url] <Uri>
-Cached
User name and password
New-TfsCredential
[-Url] <Uri>
-Password <SecureString>
-UserName <string>
Credential object
New-TfsCredential
[-Url] <Uri>
-Credential <object>
Personal Access Token
New-TfsCredential
[-Url] <Uri>
-PersonalAccessToken <string>
Prompt for credential
New-TfsCredential
[-Url] <Uri>
[-Interactive]
Azure Login
New-TfsCredential
[-Url] <Uri>
[-AzureLogin]
Parameters
Uses Azure Login credentials (DefaultAzureCredential) to authenticate to Azure DevOps. This inherits the current Azure authentication context (e.g. Azure CLI, Managed Identity, Visual Studio, Environment Variables) and obtains an Azure DevOps access token automatically. Tokens are short-lived and are automatically renewed when they expire. Ideal for CI/CD pipelines, managed identities, and scenarios where the user is already authenticated to Azure.
| Type | SwitchParameter |
| Position | (Named) |
| Default Value | (N/A) |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Specifies that cached (default) credentials should be used when possible/available.
| Type | SwitchParameter |
| Position | (Named) |
| Default Value | (N/A) |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Specifies a user account that has permission to perform this action. To provide a user name and password, a Personal Access Token, and/or to open a input dialog to enter your credentials, call Get-TfsCredential with the appropriate arguments and pass its return to this argument.
| Type | object |
| Position | (Named) |
| Default Value | (N/A) |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Prompts for user credentials. Can be used for any Team Foundation Server or Azure DevOps account - the proper login dialog is automatically selected. Should only be used in an interactive PowerShell session (i.e., a PowerShell terminal window), never in an unattended script (such as those executed during an automated build). Currently it is only supported in Windows PowerShell.
| Type | SwitchParameter |
| Position | (Named) |
| Default Value | (N/A) |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Specifies a password for authentication modes (such as Basic) that support username/password-based credentials. Must be used in conjunction with the -UserName argument
| Type | SecureString |
| Position | (Named) |
| Default Value | (N/A) |
| Accept pipeline input | False |
| Accept wildcard characters | False |
-PersonalAccessToken (Aliases: Pat)
Specifies a personal access token, used as an alternate credential, to authenticate to Azure DevOps
| Type | string |
| Position | (Named) |
| Default Value | (N/A) |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Specifies the URL of the server, collection or organization to connect to.
| Type | Uri |
| Position | 0 |
| Default Value | (N/A) |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Specifies a user name for authentication modes (such as Basic) that support username/password-based credentials. Must be used in conjunction with the -Password argument
| Type | string |
| Position | (Named) |
| Default Value | (N/A) |
| Accept pipeline input | False |
| Accept wildcard characters | False |