Skip to content

Commit a1d60b0

Browse files
authored
Merge pull request #8110 from MicrosoftDocs/users/chcomley/pats-entra-07-11
De-emphasize PATs, prioritize Entra, Refresh 3 Integration articles
2 parents 1e59f2c + b5d39e9 commit a1d60b0

File tree

8 files changed

+532
-288
lines changed

8 files changed

+532
-288
lines changed
Lines changed: 85 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,129 @@
11
---
22
ms.subservice: azure-devops-ecosystem
33
ms.topic: conceptual
4-
title: Use the Cross-platform CLI for Azure DevOps
5-
description: Use the Cross-platform CLI for Azure DevOps, using personal access tokens (PATs).
4+
title: Cross-platform CLI authentication for Azure DevOps
5+
description: Learn authentication options for the cross-platform CLI for Azure DevOps, including Microsoft Entra ID tokens and personal access tokens.
66
ms.assetid: 6dc7f977-4b62-4bd6-b77a-1c6cade1ffa8
77
monikerRange: '<= azure-devops'
88
ms.author: chcomley
99
author: chcomley
10-
ms.date: 11/10/2023
10+
ms.date: 07/14/2025
1111
---
1212

13-
# Use the Cross-platform CLI for Azure DevOps using personal access tokens
13+
# Cross-platform CLI authentication for Azure DevOps
1414

1515
[!INCLUDE [version-lt-eq-azure-devops](../../../includes/version-lt-eq-azure-devops.md)]
1616

17-
Use personal access tokens (PATs) with the cross-platform CLI for Azure DevOps.
17+
This article explains authentication approaches for the cross-platform CLI (tfx-cli) and Azure DevOps.
1818

1919
> [!IMPORTANT]
20-
> We don't recommend using basic authentication or PATs. Instead, we recommend using [Microsoft Entra-based authentication](../authentication/entra.md), if you're interacting with Microsoft Entra accounts.
20+
> We recommend using [Microsoft Entra ID authentication](../authentication/entra.md) as the primary method for authentication. Personal access tokens (PATs) should be used only when Microsoft Entra ID authentication isn't available. Basic authentication is deprecated and not recommended.
2121
2222
## Prerequisites
2323

24-
- Latest version of [**Node.js source code**](https://nodejs.org/en/download/)
25-
- **Cross-platform CLI for Azure DevOps**
26-
- Install **tfx-cli** using `npm`, a component of Node.js by running:
24+
Before you begin, ensure you have:
2725

28-
```no-highlight
29-
npm i -g tfx-cli
26+
- [Node.js](https://nodejs.org/en/download/) (latest LTS version recommended)
27+
- **tfx-cli** installed globally:
28+
29+
```bash
30+
npm install -g tfx-cli
3031
```
3132

32-
For more information about **tfx-cli**, see the [Node CLI for Azure DevOps on GitHub](https://github.com/Microsoft/tfs-cli).
33+
For more information about tfx-cli, see the [Node CLI for Azure DevOps on GitHub](https://github.com/Microsoft/tfs-cli).
3334

34-
## Personal access token
35+
## Authentication methods
3536

36-
Create a personal access token and paste it into the sign-in command.
37+
Choose the appropriate authentication method based on your environment:
3738

38-
```
39-
~$ tfx login
40-
Copyright Microsoft Corporation
39+
| Method | Recommended for |
40+
|--------|----------------|
41+
| Microsoft Entra ID | Azure DevOps Services |
42+
| PAT | Azure DevOps Server, automation scripts |
43+
| Basic Authentication | Azure DevOps Server only |
4144

42-
> Service URL: {url}
43-
> Personal access token: xxxxxxxxxxxx
44-
Logged in successfully
45+
## Microsoft Entra ID authentication (Recommended)
46+
47+
For Azure DevOps Services, use Microsoft Entra ID authentication for the best security:
48+
49+
```bash
50+
tfx login
4551
```
4652

47-
See the following examples of valid URLs:
53+
When prompted:
54+
1. Enter your service URL, for example, `https://dev.azure.com/Your_Organization`.
55+
2. Follow the browser-based authentication flow.
56+
3. Complete the sign-in process in your browser.
4857

49-
- `https://marketplace.visualstudio.com`
50-
- `https://youraccount.visualstudio.com/DefaultCollection`
58+
For detailed guidance on Microsoft Entra ID authentication, see [Microsoft Entra-based authentication](../authentication/entra.md).
5159

52-
## Configure for Basic authentication
60+
## PAT authentication
5361

54-
> [!WARNING]
55-
> We don't recommend basic authentication. Turning on IIS basic authentication causes various issues, and you should use [personal access tokens (PATs)](../../../organizations/accounts/use-personal-access-tokens-to-authenticate.md) instead. For example, if you turn on IIS basic authentication, GIT command line stops working.
62+
Use PATs when Microsoft Entra ID authentication isn't available, such as with Azure DevOps Server.
5663

57-
Follow these steps to enable basic auth for your Azure DevOps instance:
64+
### Create and use a PAT
5865

59-
> [!WARNING]
60-
> Basic authentication sends usernames and passwords in plaintext. Consider [configuring Azure DevOps Server to use SSL](/azure/devops/server/admin/setup-secure-sockets-layer) to enable secure communication when using basic auth.
66+
1. [Create a PAT](../../../organizations/accounts/use-personal-access-tokens-to-authenticate.md) with the required scopes.
67+
2. Sign in using the PAT:
6168

62-
1. Install the `Basic Authentication` feature for IIS in Server Manager.
69+
```bash
70+
tfx login
71+
```
6372

64-
> [!div class="mx-imgBorder"]
65-
> ![Screenshot of configure basic authentication feature.](./media/configureBasicAuthFeature.png)
73+
3. When prompted, provide:
74+
- **Service URL**: Your Azure DevOps instance URL.
75+
- **Personal access token**: The PAT you created.
6676

67-
2. Open IIS Manager and expand to the `Azure DevOps Server` website, double-click the `Authentication` tile in the Features view.
77+
**Example URLs:**
78+
- Azure DevOps Services: `https://dev.azure.com/Your_Organization`
79+
- Azure DevOps Server: `https://yourserver/tfs/DefaultCollection`
80+
- Visual Studio Marketplace: `https://marketplace.visualstudio.com`
6881

69-
3. Choose `Basic Authentication` in the list of authentication methods. Choose `Enable` in the right hand column. You should now see `Basic Authentication` enabled.
82+
**Example session:**
83+
```
84+
~$ tfx login
85+
Copyright Microsoft Corporation
7086

71-
> [!NOTE]
72-
> Leave the **domain** and **realm** settings for Basic Authentication empty.
87+
> Service URL: https://dev.azure.com/Your_Organization
88+
> Personal access token: **********************
89+
Logged in successfully
90+
```
7391
74-
## tfx sign in with Basic authentication
92+
## Basic authentication (Deprecated)
7593
76-
Now you can start to use `tfx` against your server. Sign in before you issue commands.
94+
> [!WARNING]
95+
> Basic authentication is deprecated and not recommended. Use Microsoft Entra ID instead. Basic authentication:
96+
> - Sends credentials in plaintext
97+
> - Can cause issues with Git command line operations
98+
> - Poses security risks
7799
78-
1. Enter the following command:
100+
### Configure basic authentication (Azure DevOps Server only)
79101
80-
```no-highlight
81-
tfx login --auth-type basic
82-
```
102+
If you must use basic authentication with Azure DevOps Server installations:
83103
84-
2. Add your service url.
85-
3. Add your username. Use `domain\user` (for example, fabrikam\peter). If you're working on a workgroup machine, use `machinename\user`.
86-
4. Add your password. Enter the password for the username that you previously entered.
104+
1. **Enable IIS Basic Authentication:**
105+
- Open Server Manager.
106+
- Install the Basic Authentication feature for IIS.
107+
- In IIS Manager, go to your Azure DevOps Server website.
108+
- Double-select **Authentication** in the Features view.
109+
- Enable Basic Authentication.
110+
- Leave domain and realm settings empty.
87111
88-
**You can now use any other tfx command.**
112+
2. **Sign in with basic authentication:**
89113
90-
```no-highlight
91-
> tfx login --auth-type basic
92-
Copyright Microsoft Corporation
114+
```bash
115+
tfx login --auth-type basic
116+
```
93117
94-
Enter service url > http://localhost:8080/tfs/defaultcollection
95-
Enter username > fabfiber\peter
96-
Enter password > *******
97-
logged in successfully
98-
```
118+
3. When prompted, provide:
119+
- **Service URL**: Your on-premises server URL (for example, `http://yourserver:8080/tfs/DefaultCollection`).
120+
- **Username**: Use `domain\username` format (for example, `fabrikam\john`)
121+
- **Password**: Your domain password.
122+
123+
> [!TIP]
124+
> Consider [configuring SSL](/azure/devops/server/admin/setup-secure-sockets-layer) for secure communication when using basic authentication.
125+
126+
## Next step
127+
128+
> [!div class="nextstepaction"]
129+
> [View the complete tfx-cli command reference](https://github.com/Microsoft/tfs-cli)

0 commit comments

Comments
 (0)