Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure DevOps Services | Azure DevOps Server | Azure DevOps Server 2022
This article explains authentication approaches for the cross-platform CLI (tfx-cli) and Azure DevOps.
Important
Consider using the more secure Microsoft Entra tokens over higher-risk personal access tokens. For more information, see Reduce PAT usage. Review the authentication guidance to choose the right authentication mechanism for your needs.
Important
Basic authentication is deprecated and not recommended.
Prerequisites
Before you begin, ensure you have:
Node.js (latest LTS version recommended)
tfx-cli installed globally:
npm install -g tfx-cli
For more information about tfx-cli, see the Node CLI for Azure DevOps on GitHub.
Authentication methods
The tfx-cli supports the following authentication methods:
| Method | Recommended for |
|---|---|
| PAT | Azure DevOps Services and Azure DevOps Server |
| Basic Authentication | Azure DevOps Server only (deprecated) |
PAT authentication
Use PATs to authenticate with Azure DevOps Services or Azure DevOps Server.
Create and use a PAT
Create a PAT with the required scopes.
Sign in using the PAT:
tfx loginWhen prompted, provide:
- Service URL: Your Azure DevOps instance URL.
- Personal access token: The PAT you created.
Example URLs:
- Azure DevOps Services:
https://dev.azure.com/Your_Organization - Azure DevOps Server:
https://yourserver/tfs/DefaultCollection - Visual Studio Marketplace:
https://marketplace.visualstudio.com
Example session:
~$ tfx login
Copyright Microsoft Corporation
> Service URL: https://dev.azure.com/Your_Organization
> Personal access token: **********************
Logged in successfully
Basic authentication (Deprecated)
Warning
Basic authentication is deprecated and not recommended. Use Microsoft Entra ID instead. Basic authentication:
- Sends credentials in plaintext
- Can cause issues with Git command line operations
- Poses security risks
Configure basic authentication (Azure DevOps Server only)
If you must use basic authentication with Azure DevOps Server installations:
Enable IIS Basic Authentication:
- Open Server Manager.
- Install the Basic Authentication feature for IIS.
- In IIS Manager, go to your Azure DevOps Server website.
- Double-click Authentication in the Features view.
- Enable Basic Authentication.
- Leave domain and realm settings empty.
Sign in with basic authentication:
tfx login --auth-type basicWhen prompted, provide:
- Service URL: Your on-premises server URL (for example,
http://yourserver:8080/tfs/DefaultCollection). - Username: Use
domain\usernameformat (for example,fabrikam\john) - Password: Your domain password.
- Service URL: Your on-premises server URL (for example,
Tip
Consider configuring SSL for secure communication when using basic authentication.