Skip to content

Commit bb76f20

Browse files
Merge pull request #8318 from SamGrantham/docs-editor/entra-tokens-1758052266
Update entra-tokens.md
2 parents 29f3075 + 606c318 commit bb76f20

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

docs/cli/entra-tokens.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.subservice: azure-devops-security
77
monikerRange: 'azure-devops'
88
ms.author: chcomley
99
author: chcomley
10-
ms.date: 05/12/2025
10+
ms.date: 09/16/2025
1111
---
1212

1313
# Issue Entra tokens with Azure CLI
@@ -22,7 +22,7 @@ Use the [**Azure CLI**](/cli/azure/install-azure-cli) to issue a [Microsoft Entr
2222
| Azure CLI     | Download and install the [Azure CLI](/cli/azure/install-azure-cli). |
2323
| Entra app | (If authenticating for a service principal) Create the Entra application and have the app client ID and client secret ready. |
2424

25-
## Acquiring an Entra token for yourself
25+
## Get an Entra token for yourself
2626

2727
# [Azure CLI](#tab/azure-cli)
2828

@@ -43,21 +43,24 @@ Use the [**Azure CLI**](/cli/azure/install-azure-cli) to issue a [Microsoft Entr
4343
```
4444

4545
# [Azure PowerShell](#tab/azure-powershell)
46+
## Get a token for a user
4647

4748
1. Sign in to Azure PowerShell using the `Connect-AzAccount` command and follow the on-screen instructions.
48-
1. Set the correct subscription for the signed-in user with these PowerShell commands. Make sure the Azure subscription ID is associated with the tenant connected to the Azure DevOps organization you're trying to access. If you don't know your subscription ID, you can find it in the [Azure portal](/azure/azure-portal/get-subscription-tenant-id).
49+
2. Set the correct subscription for the signed-in user with these PowerShell commands. Make sure the Azure subscription ID is associated with the tenant connected to the Azure DevOps organization you're trying to access. If you don't know your subscription ID, you can find it in the [Azure portal](/azure/azure-portal/get-subscription-tenant-id).
4950

5051
```azurepowershell-interactive
5152
Set-AzContext -Subscription <subscriptionID>
5253
```
5354

54-
1. Generate a Microsoft Entra ID access token with the `Get-AzAccessToken` command using the Azure DevOps resource ID: `499b84ac-1321-427f-aa17-267ca6975798`.
55+
3. Generate a Microsoft Entra ID access token with the `Get-AzAccessToken` command using the Azure DevOps resource ID: `499b84ac-1321-427f-aa17-267ca6975798`.
5556

5657
```azurepowershell-interactive
5758
Get-AzAccessToken -ResourceUrl '499b84ac-1321-427f-aa17-267ca6975798'
5859
```
60+
> [!NOTE]
61+
> [Get-AzAccessToken](/powershell/module/az.accounts/get-azaccesstoken) returns the token as a [SecureString](/dotnet/api/system.security.securestring). If you're unsure of how to use SecureString, refer to the documentation. To convert a SecureString to plain text to use in an Auth Header, leverage the .NET [[System.Runtime.InteropServices.Marshal]](/dotnet/api/system.runtime.interopservices.marshal) class to [convert](/dotnet/api/system.runtime.interopservices.marshal.securestringtobstr) the SecureString to a BSTR (binary string) pointer, then [read](/dotnet/api/system.runtime.interopservices.marshal.ptrtostringbstr) the pointer as a plain text string to a variable.
5962
60-
## Acquiring a token for a service principal
63+
## Get a token for a service principal
6164

6265
1. Sign in to the Azure CLI as the service principal using the `az devops login` command.
6366
2. Follow the on-screen instructions and finish signing in.

docs/integrate/get-started/authentication/service-principal-managed-identity.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ az login --identity
261261
az account get-access-token --resource https://app.vssps.visualstudio.com/
262262
```
263263

264-
For more information, see [Acquire Microsoft Entra tokens](../../../cli/entra-tokens.md#acquiring-a-token-for-a-service-principal).
264+
For more information, see [Acquire Microsoft Entra tokens](../../../cli/entra-tokens.md#get-a-token-for-a-service-principal).
265265

266266
### Step 5: Use tokens with Azure DevOps
267267

0 commit comments

Comments
 (0)