Risk Automations: Configure the ‘Revoke Microsoft Entra OAuth Tokens for Users’ Template
- Overview
- Step 1: Create an Entra app registration
- Step 2: Assign permissions
- Step 3: Generate a client secret
- Step 4: Add the credential to Risk Automations
- Replace the client secret before it expires
Overview
The Revoke Microsoft Entra OAuth Tokens for Users template removes OAuth tokens for a group of users on a specific app. Use it to reduce risk from OAuth tokens granted to unapproved apps or apps that are no longer in use.
Before it can run, Risk Automations needs a Microsoft Entra ID credential that connects to its own Entra app registration.
Setup workflow:
- Create an Entra app registration with permissions to revoke users’ OAuth tokens, and generate a client secret.
- Enter the app registration’s values into the Microsoft Entra ID credential.
You’ll gather three values from Entra:
- Application (client) ID
- Directory (tenant) ID
- Client secret value
🎵 New to Risk Automations templates? Start with Use Risk Automation Templates.
Step 1: Create an Entra app registration
This template needs its own Entra app registration. Don’t reuse the registration you created for your User Risk directory integration.
- Open the Microsoft Entra admin center.
- Go to Identity > Applications > App registrations.
- Click New registration.
- Enter a name (for example, UpGuard-Revoke-OAuth-Tokens).
- For Supported account types, select Single tenant.
- Click Register.
To learn more, see Microsoft’s guide: Register an application in Microsoft Entra ID.
Step 2: Assign permissions
The workflow runs without a signed-in user, so it needs application permissions, not delegated permissions.
- In your app registration, click API permissions.
- Click Add a permission, then select Microsoft Graph.
- Select Application permissions.
- Select each permission in the table below.
- Click Add permissions.
- Click Grant admin consent for [your tenant name].
- Check the Status column and confirm each permission shows Granted.
|
Permission |
What the template uses it for |
|
Directory.Read.All |
Read users and apps in your directory |
|
DelegatedPermissionGrant.ReadWrite.All |
List and delete the OAuth grants users have given to apps |
To learn more, see Microsoft’s guide: Configure app permissions for a web API.
Step 3: Generate a client secret
❗ When the secret expires, the credential can no longer authenticate to Entra and the workflow fails.
- In your app registration, click Certificates & secrets, then Client secrets.
- Click New client secret.
- Enter a description that includes the expiry date (for example, UpGuard Risk Automations revoke tokens, expires [month year]).
- Select an expiry date.
- We recommend 12 months, but you can choose a shorter period if your security policy requires it. Entra caps a secret’s lifetime at 24 months.
- You can’t extend a secret. When it expires, you create a new one.
- Add the expiry date to your team’s calendar or ticketing system so you can replace the secret before it expires.
- Click Add.
- Copy the secret Value.
🎵 Entra shows the secret value only once — if you miss it, create a new secret.
To learn more, see Microsoft’s guide: Add and manage application credentials in Microsoft Entra ID.
Step 4: Add the credential to Risk Automations
- In the Entra admin center, go to your app registration’s Overview page.
- Copy the Application (client) ID and the Directory (tenant) ID.
- In UpGuard, navigate to Risk Automations > Credentials.
- Select Microsoft Entra ID.
- For Grant Type, select Client Credentials.
- In Access Token URL, replace “common” with your Directory (tenant) ID.
- In Client ID, enter your Application (client) ID.
- In Client Secret, enter the client secret value you copied in Step 3.
- Save the credential.
Your Microsoft Entra ID credential is now saved in Risk Automations. Next: configure, test, and activate your workflow.
Replace the client secret before it expires
Replace the secret before its expiry date so the workflow keeps running.
- In the Entra admin center, go to your app registration, then Certificates & secrets > Client secrets.
- Create a new secret and copy its Value.
- In UpGuard, navigate to Risk Automations > Credentials and open the Microsoft Entra ID credential.
- Replace the Client Secret with the new value and save.
- Run the workflow to confirm it still works.
- Return to Entra and delete the old secret.
🎵 An app registration can have more than one secret at a time. The old secret keeps working until you delete it.