This commit is contained in:
Ben Alfasi 2018-08-22 10:55:10 +03:00
parent a58f04f16a
commit 9c8a74c69c
4 changed files with 9 additions and 7 deletions

View File

@ -41,6 +41,8 @@ In general, youll 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**.
![Image of Create application window](images/webapp-create.png) ![Image of Create application window](images/nativeapp-create.png)
- **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**.
![Image of new app in Azure](images/webapp-add-permission.png) ![Image of new app in Azure](images/nativeapp-add-permission.png)
5. Click **Select an API** > **WindowsDefenderATP**, then click **Select**. 5. Click **Select an API** > **WindowsDefenderATP**, then click **Select**.

View File

@ -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