Search code examples
azuremicrosoft-graph-apiazure-ad-graph-apiazure-securityazure-security-center

Get Azure Security Center tasks via API


im trying to write a backend program that will get all of Azure Security Center tasks (Recommendation) with no browser authorization involved. As far as i saw, Graph API does not have an end point for Security tasks and the only endpoint i could find is https://learn.microsoft.com/en-us/rest/api/securitycenter/tasks/list which supports only Implicit flow authorization. Is there a way to get authorization without using consent window in the browser, or to get the tasks via different endpoint?


Solution

  • For those who will need this in the future, it is possible. It didnt work for me because i requested the bearer token from the wrong address, use the following url for the bearer token request:

    https://login.microsoftonline.com/{tenantId}/oauth2/token

    And NOT:

    https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token (This is the azure AD typical bearer token request url)