Workflow to trigger Entra ID Revoke Sessions

Hi All,
I have an requirement to call the RevokeSignInSession API from microsoft graph API to revoke the sessions for Entra ID users. I have tried the below api call but it’s failing the Token Generation.

Content-Type: application/x-www-form-urlencoded
Given the Body as form-data, but in postman it was x-www-form-urlencoded. Does this cause any problem???

Any idea how to trigger this in ISC?

Thanks.

2 Likes

Hi @Santhakumar,

Try this with method as POST. I don’t think you need to pass anything in the body.

1 Like

@jesvin90 Tried but getting Request Failed error

3 Likes

Hey @Santhakumar,

For your body, can you try replacing the ‘resource’ key with ‘scope’ and replacing its value with ‘https://graph.microsoft.com/.default’.

This is from the Microsoft documentation on getting a token.

Please let me know if this helps!

  • Zach

Tried this but still get an error.

2 Likes

Here are some screenshots of one I used to create an interactive workflow for creating Entra groups. The fields should be the same for whatever you are looking to accomplish, just potentially with a different Request URL and Request Body.




Thank you,

  • Zach

The method i have trying to achieve is Get but even i deleted the HTTP Request multiple times and recreated it doesn’t work…

Deleted the whole WF and recreated but still same Request Failed error.

2 Likes

Here is the WF i have used. Can anyone tell what’s the difference??
EntraIDWF20241119.json (2.1 KB)

1 Like

Looks about the same to the working one I have setup.

Did you try this in Postman to confirm the tenantId, clientId, and clientSecret are correct and have the correct permissions?

Thank you,

  • Zach

Yes through postman i was able to generate the access token, but through WF it’s not works.

1 Like

Hi @Santhakumar,

The WF works in my tenant. Have you tried using the token to make the same call in postman.?

Looks like your error is not in retrieving the token, but in the actual get call.

I was able to do it via postman it only fails through ISC WF UI

1 Like

If i gave the token directly and try the Get user endpoint it’s work but not through auto token retrieval. Any idea why this is occurs?? Or it’s a bug/something…

Thanks.

Can you get a copy of the execution report and attach it here (after sanitizing it of course)? Exit the workflow, click on its name, switch to the Executions tab in the right side popup, and download the execution report for your latest run. I can explain this better if needed. Even for tests and not actual runs, the execution report should still be available and might have some more information to help troubleshoot this issue.

Example:

Thank you,

  • Zach

Below is the error i have seen in Downloaded Execution File

{"error":"task failed: activity error (type: sp:external:http:v2, scheduledEventID: 23, startedEventID: 24, identity: 1@sp-workflow-worker-internal-5ff6946d57-qgprh@): request failed (type: HTTP Response Returned a Client Error, retryable: false): request failed: 401 - 401 Unauthorized - {\"error\":{\"code\":\"InvalidAuthenticationToken\",\"message\":\"Access token validation failure. Invalid audience.\",\"innerError\":{\"date\":\"2024-11-19T16:12:06\",\"request-id\":\"98ff964b-14a6-43f7-a343-bc456c93a986\",\"client-request-id\":\"98ff964b-14a6-43f7-a343-bc456c93a986\"}}}"}

Thanks @Santhakumar!

Try updating your Token URL to this (adding the v2.0): https://login.microsoftonline.com/{{tenant}}/oauth2/v2.0/token

Thank you,

  • Zach

Does it need to be configure anywhere to use this v2.0? Because I have tried In my local it throws an error…

I am not entirely sure. I found this Microsoft article that has the same error you are getting and that was the resolution through Postman.

Tried the method you mentioned in the document but getting below error:

Hi Shantha,

Resource is not a valid parameter and should instead be scope with the value of “https://graph.microsoft.com/.default

Thank you,

  • Zach