Calling Microsoft Defender API from data factory

Maria Valek 80 Reputation points
2023-05-25T10:04:42.4066667+00:00

Hi All, 

I have a web activity that calls Microsoft Defender API (https://api-uk.securitycenter.microsoft.com/api/machines/SoftwareInventoryExport?sasValidHours=24). It's authenticated with a bearer token from an earlier activity. The returned results should be a list of urls to files to be downloaded.

This activity works in DEV and PRE-PROD (not many files to download), however in PROD it consistently gives an error: 

"Error calling the endpoint 'https://api-uk.securitycenter.microsoft.com'. Response status code: 'ClientSideException HttpStatusCode : 408, HttpStatusString: RequestTimeout'. More details: Exception message: 'NA - Unknown [ClientSideException] A task was canceled.'. Request didn't reach the server from the client. This could happen because of an underlying issue such as network connectivity, a DNS failure, a server certificate validation or a timeout. Url endpoint request timed out. Please make sure the endpoint response is within 1 minute and retry."

 

Anybody came across this before? It is not an authentication issue. To me it seems it just doesn't compile the results in 1 minute to return, hence the server closes the connection. But if that's the case, unsure how to solve that.

 

Just to note, the one time it actually returned a results it was a list of about 1,400 URLs. 

Thank you.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Sedat SALMAN 14,280 Reputation points MVP Volunteer Moderator
    2023-05-25T13:55:38.8033333+00:00

    The Azure Data Factory's web activity has a default timeout of 1 minute, and it seems like the Microsoft Defender API is taking longer than that to compile the results in your PROD environment.

    You can increase the timeout of the web activity. In the policy section of the web activity, set timeout to a larger value (in seconds). However, please note that the maximum timeout period for a web activity in Azure Data Factory is 230 seconds (a bit less than 4 minutes). If you think the API response will take longer than that, you may need to consider other approaches. If the API supports pagination, you could make multiple calls to the API, each time retrieving a subset of the data, rather than trying to retrieve everything at once. However, this will depend on whether the Microsoft Defender API supports pagination.


0 additional answers

Sort by: Most helpful

Your answer

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