You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/dev-box/how-to-authenticate.md
+12-7Lines changed: 12 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,18 @@
1
1
---
2
2
title: Authenticate to Microsoft Dev Box REST APIs
3
-
description: Learn how to authenticate to Microsoft Dev Box REST APIs.
3
+
description: Learn how to authenticate to Microsoft Dev Box REST APIs as administrator or developer, by using the Azure CLI.
4
4
ms.service: dev-box
5
-
ms.topic: conceptual
5
+
ms.topic: concept-article
6
6
ms.author: rosemalcolm
7
7
author: RoseHJM
8
-
ms.date: 09/07/2023
8
+
ms.date: 01/31/2025
9
+
10
+
#customer intent: As a developer, I want to learn how to authenticate to Microsoft Dev Box REST APIs, so that I can securely interact with Microsoft Dev Box services.
9
11
---
10
12
# Authenticating to Microsoft Dev Box REST APIs
11
13
14
+
In this article, you will learn how to authenticate to Microsoft Dev Box REST APIs using the Azure CLI. Authentication is a crucial step for accessing both administrator (control plane) and developer (data plane) APIs. This guide will walk you through retrieving an access token from Microsoft Entra ID, understanding the token's structure and validity, and using the bearer token to access REST APIs. By following these steps, you can securely interact with Microsoft Dev Box services.
15
+
12
16
> [!TIP]
13
17
> Before authenticating, ensure that the user or identity has the appropriate permissions to perform the desired action. For more information, see [configuring project admins](./how-to-project-admin.md) and [configuring Dev Box users](./how-to-dev-box-user.md).
14
18
@@ -29,7 +33,7 @@ az login
29
33
30
34
The command opens a browser window to the Microsoft Entra authentication page. It requires you to give your Microsoft Entra user ID and password.
31
35
32
-
Next, set the correct subscription context. If you authenticate from an incorrect subscription or tenant you may receive unexpected 403 Forbidden errors.
36
+
Next, set the correct subscription context. If you authenticate from an incorrect subscription or tenant, you might receive unexpected 403 Forbidden errors.
33
37
34
38
```azurecli
35
39
az account set --subscription <subscription_id>
@@ -41,7 +45,7 @@ az account set --subscription <subscription_id>
41
45
### Retrieve the Microsoft Entra access token
42
46
43
47
Use the Azure CLI to acquire an access token for the Microsoft Entra authenticated user.
44
-
Note that the resource ID is different depending on if you are accessing administrator (control plane) APIs or developer (data plane) APIs.
48
+
The resource ID is different depending on if you're accessing administrator (control plane) APIs or developer (data plane) APIs.
45
49
46
50
For administrator APIs, use the following command:
47
51
```azurecli-interactive
@@ -68,11 +72,12 @@ After authentication is successful, Microsoft Entra ID returns an access token f
68
72
The token is a Base64 string. The token is valid for at least 5 minutes with the maximum of 90 minutes. The expiresOn defines the actual token expiration time.
69
73
70
74
> [!TIP]
71
-
> Developer API tokens for the service are encrypted and cannot be decoded using JWT decoding tools. They can only be processed by the service.
75
+
> Developer API tokens for the service are encrypted and can't be decoded using JWT decoding tools. They can only be processed by the service.
72
76
73
77
74
78
### Using a bearer token to access REST APIs
75
79
To access REST APIs, you must set the Authorization header on your request. The header value should be the string `Bearer` followed by a space and the token you received in the previous step.
0 commit comments