Is it possible to download the eDiscovery exports download url like https://neur.proxyservice.ediscovery.office365.com/ediscovery/api/proxy/exportaedblobFileResult(...) using Azure App permissions programmatically?

Suman Chukka 20 Reputation points
2025-04-23T04:51:41.0133333+00:00

I used security.ediscovery Graph API to get the download url for the exports using Azure SP using app credentials, for example I got download url as https://neur.proxyservice.ediscovery.office365.com/ediscovery/api/proxy/exportaedblobFileResult(.............), is it possible to download programmatically using app credentials access token? When I am doing this, I am getting http 200 but some html content is downloading instead of actual file.

Microsoft Purview
Microsoft Purview
A Microsoft data governance service that helps manage and govern on-premises, multicloud, and software-as-a-service data. Previously known as Azure Purview.
1,532 questions
{count} votes

Accepted answer
  1. Vasil Michev 117.1K Reputation points MVP
    2025-04-23T05:53:05.9+00:00

    You need to pass the X-AllowWithAADToken header in addition to the authentication one:

    $authHeader = @{
    'Content-Type'='application\json'
    'Authorization'="Bearer $($token.AccessToken)"
    'X-AllowWithAADToken' = "true"
    }
     
    $uri = 'https://neur.proxyservice.ediscovery.office365.com/ediscovery/api/proxy/exportaedblobFileResult(blablabla)'
    Invoke-WebRequest -Uri $uri -Headers $authHeader -Verbose -OutFile "D:\Downloads\1.zip"
    

    I have a more detailed explanation in this article: https://www.michev.info/blog/post/5806/using-the-graph-api-to-export-ediscovery-premium-datasets


0 additional answers

Sort by: Most helpful

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.