How to automate the process of export and download of review set in Microsoft purview using API

Casepoint Developer 66 Reputation points
2023-10-25T05:08:47.92+00:00

Hii,

I got documentation that states how we can automate the process of exporting and downloading of review set in Microsoft Purview without interrupting with sign-in page.

Documentation link: https://learn.microsoft.com/en-us/graph/api/security-caseoperation-get?view=graph-rest-1.0&tabs=http

User's image

I have completed Step1 & Step2 by creating Service Principal and adding scope to my client APP from resource service principal using API (POST https://graph.microsoft.com/v1.0/oauth2PermissionGrants)

Documentation link: https://learn.microsoft.com/en-us/graph/permissions-grant-via-msgraph?pivots=grant-delegated-permissions&tabs=http

I am not getting Step3 & Step4, I am not getting how to approve the request by tenant admin and where to pass scope and header ("X-AllowWithAADToken", "true");

Thanks

Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Purview
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 119.6K Reputation points MVP Volunteer Moderator
    2023-10-25T07:01:48.2033333+00:00

    When you add the scope to your custom app, you need to also grant admin consent to it, otherwise any attempt to obtain a token will trigger the admin consent prompt. After consent is granted, use your custom app to obtain an access token (for the specified resource, b26e684c-5068-4120-a679-64a5d2c909d9). Then add it to your curl/Invoke-WebRequest request, along with the X-AllowWithAADToken header.

    I posted some more detailed instructions here, if the above is not clear: https://www.michev.info/blog/post/5806/using-the-graph-api-to-export-ediscovery-premium-datasets


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.