Search code examples
apimicrosoft-graph-apiazure-securitysecuritycenter

Authorization Token for Azure Security Center to dismiss the alerts


I am trying to dismiss the alerts using API. I am following this link Alert Update . Now I am able to dismiss the alert using this link successfully but I have tried using PostMan and I failed, After looking into the documentation I got to know that I will need the Authorization Token to do this using PostMan but I don't know how can I create or obtain one. Does anyone know how to create the Token specifically for Azure Security Center?

Any help is appreciated. Thanks! Anmol


Solution

  • This is the doc about acquiring an access token. You could use auth-code-flow to get access_token.

    1.Request an authorization code

    https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?
    client_id=6731de76-14a6-49ae-97bc-6eba6914391e
    &response_type=code
    &redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F
    &response_mode=query
    &scope=openid%20offline_access%20https%3A%2F%2Fgraph.microsoft.com%2Fmail.read
    &state=12345
    

    2.Request an access token

    POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token 
    Content-Type: application/x-www-form-urlencoded
    
    client_id=6731de76-14a6-49ae-97bc-6eba6914391e
    &scope=https%3A%2F%2Fgraph.microsoft.com%2Fmail.read
    &code= {code acquired above}
    &redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F
    &grant_type=authorization_code
    &client_secret=JqQX2PNo9bpM0uEihUPzyrh    // NOTE: Only required for web apps. This secret needs to be URL-Encoded.
    

    Note: scope is mentioned from the link.

    enter image description here