Microsoft Purview eDiscovery
Developer and PowerShell

Edisc Ref Api Guide

In brief

The guide adds a GCC limitation for app-based authentication when downloading eDiscovery exports through Microsoft Graph and clarifies the application IDs, scopes, and authentication parameters required by the scripts.

What Purview admins need to know

Administrators using these scripts should replace placeholder values with the correct MicrosoftPurviewEDiscovery application ID. GCC administrators cannot use app-based authentication for export downloads.

Summaries are generated from the documentation change itself.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.

You can configure the Microsoft Purview eDiscovery API to enable the programmatic download of export packages and the reports from an export process in an eDiscovery case.

Important

App-based authentication for eDiscovery export downloads through Microsoft Graph is currently not supported in Government Community Cloud (GCC). This limitation is specific to export downloads and isn't a general restriction on app-based authentication for eDiscovery APIs.

Prerequisites for Microsoft Purview eDiscovery API

Before you execute the configuration steps in this section, complete and validate the configuration detailed in the Microsoft Graph API section. Extend the previously registered app in Microsoft Entra ID to include the required permissions to achieve programmatic download of the export package.

If this is the first time using Microsoft Graph PowerShell cmdlets, you might be prompted to consent to required permissions.

To register the **MicrosoftPurviewEDiscovery** app, run the following PowerShell commands:commands. Replace `<MicrosoftPurviewEDiscovery application ID>` with the Application ID of the MicrosoftPurviewEDiscovery app, not the Application (client) ID of your own registered app. Use this same MicrosoftPurviewEDiscovery application ID in the export-token scope in the example download scripts.

```powershell
$spId = @{"AppId" = "00001111-aaaa-2222-bbbb-3333cccc4444<MicrosoftPurviewEDiscovery application ID>" }
```

```powershell

The following example scripts can be used as a reference when developing your own scripts to enable the programmatic download of the export packages.

Use the following values for the authentication parameters in both scripts:

Parameter or placeholderValue
tenantIdThe Directory (tenant) ID of your Microsoft Entra tenant.
appIdThe Application (client) ID of your own registered app, configured with the permissions in Step 2. This value is passed to ClientId for both Microsoft Graph and export-token authentication.
appSecret or certPathThe client secret value or the certificate store path for your own registered app.
<MicrosoftPurviewEDiscovery application ID>The Application ID of the MicrosoftPurviewEDiscovery Microsoft application registered in Step 1. Find this value in Microsoft Entra ID > Enterprise applications > MicrosoftPurviewEDiscovery > Overview > Application ID. Don't use the Object ID or your own app's Application (client) ID.

In each script, replace <MicrosoftPurviewEDiscovery application ID> in the export-token scope and retain the /.default suffix. This scope identifies the Microsoft Purview eDiscovery API that receives the token. In the certificate example, the Scope entry in $connectionDetails uses this value, while ClientId remains your own registered app's ID.

Connecting with a client secret

If you configured your app to use a client secret, use the following example script as a reference to download the export package and reports programmatically. Copy the contents into Notepad and save it as DownloadExportUsingApp.ps1. }

Write-Host "Connect with credentials of a ediscovery admin (token for export)" $exportToken = Get-MsalToken -ClientId $appId -Scopes "00001111-aaaa-2222-bbbb-3333cccc4444//.default" -TenantId $tenantId -RedirectUri "http://localhost" -ClientSecret $password

$uri = "/v1.0/security/cases/ediscoveryCases/$($caseId)/operations/$($exportId)"

'TenantId'          = $tenantId
'ClientId'          = $appID
'ClientCertificate' = $ClientCert
'Scope' = "00001111-aaaa-2222-bbbb-3333cccc4444/<MicrosoftPurviewEDiscovery application ID>/.default"

}

$exportToken = Get-MsalToken @connectionDetails