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: defender-endpoint/api/exposed-apis-create-app-partners.md
+54-45Lines changed: 54 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ ms.service: defender-endpoint
6
6
ms.author: siosulli
7
7
author: siosulli
8
8
ms.localizationpriority: medium
9
-
ms.date: 01/25/2023
9
+
ms.date: 06/28/2024
10
10
manager: deniseb
11
11
audience: ITPro
12
12
ms.collection:
@@ -46,13 +46,19 @@ Microsoft Defender for Endpoint exposes much of its data and actions through a s
46
46
47
47
In general, you need to take the following steps to use the APIs:
48
48
49
-
- Create a **multi-tenant** Microsoft Entra application.
50
-
- Get authorized(consent) by your customer administrator for your application to access Defender for Endpoint resources it needs.
51
-
- Get an access token using this application.
52
-
- Use the token to access Microsoft Defender for Endpoint API.
49
+
1. Create a multi-tenant Microsoft Entra application.
50
+
51
+
2. Get authorized(consent) by your customer administrator for your application to access Defender for Endpoint resources it needs.
52
+
53
+
3. Get an access token using this application.
54
+
55
+
4. Use the token to access Microsoft Defender for Endpoint API.
53
56
54
57
The following steps guide you how to create a Microsoft Entra application, get an access token to Microsoft Defender for Endpoint and validate the token.
55
58
59
+
> [!IMPORTANT]
60
+
> Microsoft recommends that you use roles with the fewest permissions. This helps improve security for your organization. Global Administrator is a highly privileged role that should be limited to emergency scenarios when you can't use an existing role.
61
+
56
62
## Create the multitenant app
57
63
58
64
1. Sign in to your [Azure tenant](https://portal.azure.com) with user that has **Global Administrator** role.
@@ -75,34 +81,34 @@ The following steps guide you how to create a Microsoft Entra application, get a
75
81
76
82
- On your application page, select **API Permissions**\>**Add permission**\>**APIs my organization uses** > type **WindowsDefenderATP** and select on **WindowsDefenderATP**.
77
83
78
-
-Note that *WindowsDefenderATP* doesn't appear in the original list. Start writing its name in the text box to see it appear.
84
+
-`WindowsDefenderATP` doesn't appear in the original list. Start writing its name in the text box to see it appear.
79
85
80
86
:::image type="content" source="../media/add-permission.png" alt-text="The Add a permission option" lightbox="../media/add-permission.png":::
81
87
82
88
### Request API permissions
83
89
84
-
To determine which permission you need, review the **Permissions** section in the API you're interested to call. For instance:
90
+
To determine which permission you need, review the **Permissions** section in the API you want to call. For instance:
85
91
86
-
- To [run advanced queries](run-advanced-query-api.md), select 'Run advanced queries' permission
87
-
- To [isolate a device](isolate-machine.md), select 'Isolate machine' permission
92
+
- To [run advanced queries](run-advanced-query-api.md), select the **Run advanced queries** permission.
93
+
- To [isolate a device](isolate-machine.md), select the **Isolate machine** permission.
88
94
89
-
In the following example we use **'Read all alerts'** permission:
95
+
In the following example we use **Read all alerts** permission:
90
96
91
97
1. Choose **Application permissions**\>**Alert.Read.All** > select on **Add permissions**
92
98
93
99
:::image type="content" source="../media/application-permissions.png" alt-text="The option that allows to add a permission" lightbox="../media/application-permissions.png":::
94
100
95
101
2. Select **Grant consent**
96
102
97
-
-**Note**: Every time you add permission you must select on **Grant consent** for the new permission to take effect.
103
+
- Every time you add permission you must select on **Grant consent** for the new permission to take effect.
98
104
99
105
:::image type="content" source="../media/grant-consent.png" alt-text="The option that allows consent to be granted" lightbox="../media/grant-consent.png":::
100
106
101
107
3. Add a secret to the application.
102
108
103
109
- Select **Certificates & secrets**, add description to the secret and select **Add**.
104
110
105
-
**Important**: After you select **Add**, make sure to copy the generated secret value. You won't be able to retrieve it after you leave!
111
+
After you select **Add**, make sure to copy the generated secret value. You won't be able to retrieve it after you leave!
@@ -136,7 +142,7 @@ In the following example we use **'Read all alerts'** permission:
136
142
137
143
## Get an access token example
138
144
139
-
**Note:**To get access token on behalf of your customer, use the customer's tenant ID on the following token acquisitions.
145
+
To get access token on behalf of your customer, use the customer's tenant ID on the following token acquisitions.
140
146
141
147
For more information on Microsoft Entra token, see [Microsoft Entra tutorial](/azure/active-directory/develop/active-directory-v2-protocols-oauth-client-creds).
142
148
@@ -166,61 +172,63 @@ return $token
166
172
167
173
### Using C#
168
174
169
-
> The below code was tested with Nuget Microsoft.Identity.Client
170
-
171
175
> [!IMPORTANT]
172
-
> The [Microsoft.IdentityModel.Clients.ActiveDirectory](https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory) NuGet package and Azure AD Authentication Library (ADAL) have been deprecated. No new features have been added since June 30, 2020. We strongly encourage you to upgrade, see the [migration guide](/azure/active-directory/develop/msal-migration) for more details.
176
+
> The [Microsoft.IdentityModel.Clients.ActiveDirectory](https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory) NuGet package and Azure AD Authentication Library (ADAL) have been deprecated. No new features have been added since June 30, 2020. To upgrade, see the [migration guide](/azure/active-directory/develop/msal-migration).
## Use the token to access Microsoft Defender for Endpoint API
244
253
245
254
1. Choose the API you want to use. For more information, see [Supported Microsoft Defender for Endpoint APIs](exposed-apis-list.md).
246
255
247
-
2. Set the Authorization header in the Http request you send to "Bearer {token}" (Bearer is the Authorization scheme). The Expiration time of the token is 1 hour (you can send more than one request with the same token).
256
+
2. Set the Authorization header in the Http request you send to `Bearer {token}` (Bearer is the Authorization scheme). The Expiration time of the token is one hour (you can send more than one request with the same token).
248
257
249
-
Here's an example of sending a request to get a list of alerts **using C#**
258
+
Here's an example of sending a request to get a list of alerts using C#:
0 commit comments