mirror of
https://github.com/MicrosoftDocs/windows-itpro-docs.git
synced 2025-05-19 16:57:23 +00:00
step
This commit is contained in:
parent
a58f04f16a
commit
9c8a74c69c
@ -41,6 +41,8 @@ In general, you’ll need to take the following steps to use the APIs:
|
|||||||
|
|
||||||
This page explains how to create an app, get an access token to Windows Defender ATP and validate the token includes the required permission.
|
This page explains how to create an app, get an access token to Windows Defender ATP and validate the token includes the required permission.
|
||||||
|
|
||||||
|
**Note**: When accessing WDATP API on behalf of a user, you will need the correct app permission and user permission.
|
||||||
|
|
||||||
## Create an app
|
## Create an app
|
||||||
|
|
||||||
1. Log on to [Azure](https://portal.azure.com).
|
1. Log on to [Azure](https://portal.azure.com).
|
||||||
@ -51,16 +53,16 @@ This page explains how to create an app, get an access token to Windows Defender
|
|||||||
|
|
||||||
3. In the Create window, enter the following information then click **Create**.
|
3. In the Create window, enter the following information then click **Create**.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- **Name:** WdatpEcosystemPartner
|
- **Name:** <Your app name>
|
||||||
- **Application type:** Web app / API
|
- **Application type:** Native
|
||||||
- **Redirect URI:** `https://WdatpEcosystemPartner.com` (The URL where user can sign in and use your app. You can change this URL later.)
|
- **Redirect URI:** `https://127.0.0.1`
|
||||||
|
|
||||||
|
|
||||||
4. Click **Settings** > **Required permissions** > **Add**.
|
4. Click **Settings** > **Required permissions** > **Add**.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
5. Click **Select an API** > **WindowsDefenderATP**, then click **Select**.
|
5. Click **Select an API** > **WindowsDefenderATP**, then click **Select**.
|
||||||
|
|
||||||
|
@ -150,9 +150,9 @@ For more details on AAD token, refer to [AAD tutorial](https://docs.microsoft.co
|
|||||||
string appSecret = "22222222-2222-2222-2222-222222222222"; // Paste your own app secret here
|
string appSecret = "22222222-2222-2222-2222-222222222222"; // Paste your own app secret here
|
||||||
|
|
||||||
const string authority = "https://login.windows.net";
|
const string authority = "https://login.windows.net";
|
||||||
const string wdatpResource = "https://api.securitycenter.windows.com/";
|
const string wdatpResourceId = "https://api.securitycenter.windows.com/";
|
||||||
|
|
||||||
AuthenticationContext auth = new AuthenticationContext($"{aadUri}/{tenantId}/");
|
AuthenticationContext auth = new AuthenticationContext($"{authority}/{tenantId}/");
|
||||||
ClientCredential clientCredential = new ClientCredential(appId, appSecret);
|
ClientCredential clientCredential = new ClientCredential(appId, appSecret);
|
||||||
AuthenticationResult authenticationResult = auth.AcquireTokenAsync(wdatpResourceId, clientCredential).GetAwaiter().GetResult();
|
AuthenticationResult authenticationResult = auth.AcquireTokenAsync(wdatpResourceId, clientCredential).GetAwaiter().GetResult();
|
||||||
string token = authenticationResult.AccessToken;
|
string token = authenticationResult.AccessToken;
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
Loading…
x
Reference in New Issue
Block a user