sodcalculator

10 Tech How-To

Revoke Malicious Microsoft 365 App Permissions & Sessions

Guide 10-52093 · Updated · Step by step

If a third-party app you connected to Microsoft 365 turns out to be malicious, it can silently read your email, access files, or send messages on your behalf. This guide shows you how to revoke its permissions and sign out its active sessions, locking it out before it does more damage.

What You’ll Need

  • Global Administrator or Application Administrator role in Microsoft 365 (to revoke tenant-wide permissions).
  • Access to the Microsoft 365 admin center (admin.microsoft.com) and the Azure portal (portal.azure.com).
  • The name or App ID of the malicious app (you can find it in the Enterprise Applications list).

Step-by-Step

  1. Identify the malicious app. Go to the Microsoft 365 admin center > Health > Service health > App permissions (or search for “App permissions”). Review the list of apps with access. Note the exact name or App ID of the suspicious one.
  2. Block the app immediately (if possible). In the same App permissions page, select the app and choose Block. This prevents new sign-ins and token issuance, but does not revoke existing tokens.
  3. Revoke the app’s permissions in Azure AD. Go to portal.azure.com > Microsoft Entra ID > Enterprise applications. Find the app (use the search bar) and open it.
  4. Remove user consent (if any). Under the app’s Permissions tab, review the delegated permissions. For each user who granted consent, you can remove their consent by going to Users and groups, selecting the user, and clicking Remove. This revokes that user’s access but does not remove admin consent.
  5. Revoke admin consent. If the app has tenant-wide admin consent (shown as “Granted for all users”), click Revoke permissions on the Permissions page. This removes all permissions granted by the admin.
  6. Disable the app. On the app’s Properties page, set Enabled for users to sign-in? to No and click Save. This prevents any further sign-in attempts.
  7. Revoke refresh tokens and sessions. Use PowerShell to revoke all tokens issued to the app. Connect to Exchange Online and run: Get-User | Revoke-SignInSessions (or use the Azure AD PowerShell command Revoke-AzureADUserAllRefreshToken -ObjectId <user-id> for specific users). This forces users to re-authenticate and invalidates any tokens the app holds.
  8. Delete the app (optional but recommended). If you are certain the app is malicious, go to the app’s Properties page and click Delete. This removes the service principal and all its permissions.

Common Mistakes

  • Only blocking the app without revoking tokens – existing tokens remain valid until they expire (often up to 90 days).
  • Forgetting to revoke user consent – the app may still have access via a user’s delegated permissions.
  • Not disabling the app – the app can still be re-enabled by an attacker if they have admin credentials.
  • Overlooking apps with same names – always verify the App ID to avoid revoking a legitimate app.

Tips

  • Act quickly: revoke tokens and disable the app within minutes of detection.
  • Use the Sign-in logs in Azure AD to see which users have used the app, so you can target token revocation.
  • After revoking, monitor the sign-in logs for any failed attempts from the app.
  • Consider enabling User consent settings to require admin approval for all third-party apps in the future.

Troubleshooting

I don’t see the app in Enterprise applications. The app might be a multi-tenant app that was added via user consent. Search for it by App ID in the “All applications” filter. If it’s not there, check the App registrations blade.

Revoke permissions button is greyed out. This happens when the app has no admin consent. In that case, only user-level revocations work. Remove all users from the app’s Users and groups.

PowerShell command fails. Ensure you have the required modules installed (AzureAD or Microsoft Graph PowerShell). Run as administrator and sign in with Global Admin.

App still shows as active after deletion. Wait a few minutes for replication. If it persists, check if the app was registered as a multi-tenant app – you may need to revoke consent in the home tenant.

Frequently Asked Questions

Q: How do I know if an app is malicious?
A: Look for apps with excessive permissions (e.g., read all mail, full access to files) that you don’t remember installing. Check the publisher and the date it was added. If in doubt, revoke and investigate.

Q: What is the difference between user consent and admin consent?
A: User consent is granted by an individual user, allowing the app to access that user’s data. Admin consent is granted by an administrator and applies to all users in the tenant. Revoking admin consent is more critical.

Q: Will revoking sessions log out all users?
A: Yes, revoking refresh tokens forces users to sign in again, which is a temporary inconvenience but necessary for security.

Q: Can I revoke permissions for a single user?
A: Yes, remove the user from the app’s Users and groups and revoke that user’s refresh tokens.

Q: How long does it take for the changes to take effect?
A: Usually within a few minutes, but token revocation can take up to an hour to propagate across all services.

Q: What if the app is a first-party Microsoft app?
A: Do not revoke permissions for Microsoft-owned apps (like Microsoft Teams or Office). Only revoke third-party apps you don’t recognize.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →