Link

New-TfsCredential

Provides credentials to use when you connect to a Team Foundation Server or Azure DevOps organization.


Table of Contents

  1. Syntax
  2. Parameters
  3. Outputs
  4. Related Links

Syntax

Cached credentials

New-TfsCredential
    [-Url] <Uri>
    [-Cached]

User name and password

New-TfsCredential
    [-Url] <Uri>
    [-UserName] <string>
    [-Password <SecureString>]

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

[Go to top]

Parameters

-Cached

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

-Credential

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

-Interactive

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

-Password

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 2
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

-Url

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

-UserName

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 1
Default Value (N/A)
Accept pipeline input False
Accept wildcard characters False

Outputs

Microsoft.VisualStudio.Services.Common.VssCredentials