Book a demo →
← All posts

Shadow IT discovery from audit logs: a step-by-step guide

Find shadow IT in your audit logs. Pull Microsoft 365, Entra ID and Google Workspace logs, build an app list, triage by data access, and keep it running.

Shadow IT discovery from audit logs: a step-by-step guide

Shadow IT discovery can start with logs you already have. Pull the Microsoft 365 unified audit log, the Microsoft Entra sign-in and audit logs, and the Google Workspace OAuth log. List every app that has a grant or a sign-in, then rank each app by the data it can reach. Audit logs can miss apps that people joined with a password, so add one more source: the sign-up, welcome and invoice emails in the mailbox.

This guide gives the console path for each step. The Google Workspace route is in square brackets.

What each log shows and where to find it

Log sourceWhat it showsWhere to find itHow far back
Microsoft 365 unified audit logAdmin and user activity across Microsoft services, including app registrations and permission grants1,2Microsoft Purview portal > Audit, or Search-UnifiedAuditLog180 days; one year for E5 users on Entra, Exchange, SharePoint and OneDrive activity1
Entra sign-in logsWho signed in to which application3Entra admin center > Entra ID > Monitoring & health > Sign-in logs7 days (Free), 30 days (P1, P2)4
Entra audit logsChanges to applications, including "Consent to application"5Entra ID > Monitoring & health > Audit logs7 days (Free), 30 days (P1, P2)4
Google OAuth log eventsEach time a third-party app is authorized, with app name, client ID and scopes6Admin console > Reporting > Audit and investigation > OAuth log events6 months7
Google User log eventsSign-ins to Google accounts, with the login type8Reporting > Audit and investigation > User log events6 months7
Mailbox (message trace, Gmail log events)Sign-up, welcome and receipt emails from vendors9,10Exchange admin center > Mail flow > Message trace; Security center > Investigation toolUp to 90 days in message trace9

How to find shadow IT in audit logs, step by step

  1. Confirm audit logging is on and search for app grants. In Exchange Online PowerShell, run Get-AdminAuditLogConfig | Format-List UnifiedAuditLogIngestionEnabled and check that it returns True1. In the Microsoft Purview portal, open Audit, set the 180 day maximum range, and search the operations Add service principal. and Add delegation entry., typed exactly as Microsoft lists them1,2. You need the Audit Logs or View-Only Audit Logs role1. For a script, run Search-UnifiedAuditLog -StartDate <start> -EndDate <end> -Operations "Add delegation entry." -SessionCommand ReturnLargeSet, which returns up to 50,000 results11. [Google Workspace: use steps 2 and 3.] These events record an app being registered and a permission being given to it2, so every result is an app someone added.
  2. Export the Entra sign-in logs. Sign in to the Microsoft Entra admin center as at least Reports Reader, go to Entra ID > Monitoring & health > Sign-in logs, and select Download12. Group the rows by application and list each one that is not a Microsoft app and not on your approved list. The log shows how many users signed in to each application3, which gives you a user count. Export now, because Free keeps 7 days and P1 or P2 keeps 304. [Google Workspace: go to Menu > Reporting > Audit and investigation > OAuth log events, filter the event type to API call, and export. Requires the Audit & Investigation privilege6.]
  3. Export the OAuth consent events. In the Entra admin center, go to Entra ID > Monitoring & health > Audit logs, filter the activity "Consent to application", and download5,12. The audit log keeps the same 7 or 30 days4. [Google Workspace: in Menu > Reporting > Audit and investigation > OAuth log events, widen the default 7 days to 6 months and export the grant events (the API calls them authorize events)6,7,13.] A consent event is the moment an app got access to data, and the scope field says which data.
  4. Search the mailbox for sign-up mail. In the Exchange admin center, go to Mail flow > Message trace, select Start a trace, set Direction to Inbound, and add a Subject filter with "contains" for words such as welcome, verify, receipt and invoice9. Summary reports cover 10 days at a time and the range goes to 90 days9. Export the results and group them by sender domain. [Google Workspace: go to Menu > Security > Security center > Investigation tool, choose the data source Gmail log events, and add a Subject condition10.] Apps joined with a work email and a password may leave no grant or sign-in event, but they still send a welcome email.
  5. Build one app list. In the Entra admin center, go to Entra ID > Enterprise apps > All applications, set Application Type to Enterprise Applications, and add the Created on filter14. [Google Workspace: go to Menu > Security > Access and data control > API controls > Manage Third-Party App Access, and open Accessed apps. It needs the Service Settings privilege and updates 48 hours after a token is granted or revoked15.] Put every app from steps 1 to 4 in one sheet with its sender domain, user count, first seen date, scopes and approval status. The same app has different names in each log, so one row per app is the only way to count its users.
  6. Triage by data scope and by who uses it. In Entra ID > Enterprise apps > All applications, open each app, select Permissions, and read the Admin consent and User consent tabs16. [Google Workspace: read the scope field in OAuth log events6, then open User log events for that user and date to check the login type and IP address8.] Rank first the apps whose permissions read mail or files, then the ones with the most users. This is our suggested order, not a Microsoft rule. Microsoft notes that by default a user can let an app access their own mailbox17, so mail access is a grant a user can make alone. The ranking tells you where to spend your first hour.
  7. Decide: sanction, restrict or remove. Write one decision per app, with an owner and a review date.
    • Sanction: add the app to your approved list with its owner and the data it may touch. [Google Workspace: set its access level in Manage Third-Party App Access15.]
    • Restrict: sign in as a Global Administrator, go to Identity > Applications > Enterprise apps > Consent and permissions > User consent settings, and limit user consent. Microsoft recommends allowing it only for apps from verified publishers17. [Google Workspace: point to the app, select Change access, and choose Limited, which allows only unrestricted Google services15.]
    • Remove: on the app's Permissions page, open the Admin consent tab, select the ... control and choose Revoke permission16. User consent grants cannot be revoked in the portal and need Microsoft Graph or PowerShell16. [Google Workspace: Change access, then Blocked, which stops access to any Google service15.]

    Revoking does not stop people consenting again, so change the consent setting too16. One decision per app keeps the list from going stale.

  8. Keep it running. Put a monthly reminder in the owner's calendar to repeat steps 1 to 5 and compare the sheet with last month's. Entra keeps its own logs 30 days at most, so a longer gap loses events4. Send each new row to step 6. Microsoft also suggests turning on the admin consent workflow, so users can ask an admin to review an app they are not allowed to consent to17.

Where audit logs fall short

For shadow IT discovery, audit logs have two gaps. They record sign-ins and grants. They do not record an app that someone joined with their own email and password, and they cannot see accounts opened with a personal address.

In our reading, the first gap is why the mailbox step matters: the app still sends a welcome mail to the work address. The second gap stays open. A sign-up on a personal address leaves nothing in the company's logs or mailbox, and the AegisAI page names the same limit for its own mail reading18.

The logs are also short. Entra keeps 7 or 30 days4, and Google keeps 6 months7. A grant made before that window is invisible, so an app that was added long ago and never used again will not show up. The Enterprise apps list in step 5 is your best view of those.

How AegisAI helps with shadow IT discovery

AegisAI covers the mailbox signal from step 4 without a manual search. It reads the sign-up mail it already sees in Google Workspace or Microsoft 365 and builds an inventory of apps adopted with a company identity, AI tools first18. It ranks them by the data they expose, shows who uses each one, by team, and cross-checks against Okta or an approved list you upload as a CSV18. There is no agent, no proxy and no MX change, and connecting takes about five minutes18.

AegisAI has limits, and the page states them. It does not see AI tools signed up with a personal email, it does not read prompts or uploaded files, and it cannot revoke access or block an app. Revocation stays in your identity provider or admin console18. Read more on the AegisAI shadow IT and AI discovery page, see how to discover SaaS apps employees signed up for with a work email, or book a demo.

Frequently asked questions

Which log finds the most shadow IT?

The OAuth consent events and the Enterprise apps list find apps that were given access to data. The sign-in logs find apps people use through single sign-on. Use all three, plus the mailbox search, because each sees a different kind of app. Steps 2 to 5 show the paths.

How far back can I look?

Microsoft 365 keeps unified audit records for 180 days, or one year for E5 users on Entra, Exchange, SharePoint and OneDrive activity1. Entra keeps its own sign-in and audit logs for 7 days (Free) or 30 days (P1, P2)4. Google keeps OAuth token and user log events for 6 months7.

Do I need an E5 licence to run this?

No. The unified audit log works on other licences with 180 day retention1. E5 adds the one year window. Step 1 shows the role you need.

Can audit logs find AI tools?

Audit logs show AI tools that were given an OAuth grant or signed in through your tenant. A tool joined with an email and password may show only in the mailbox search in step 4, and only if the sign-up used a work address.

Does revoking an app keep it out?

No. Microsoft says revoking a grant does not stop users from consenting again16. Change the consent setting as well, as in step 7.

Can AegisAI revoke or block an app?

Not today. AegisAI finds and ranks the apps. Revocation happens in your identity provider or admin console18.

Sources

Each number in the text opens the source with the same number.

  1. 1Microsoft LearnSearch the audit log
  2. 2Microsoft LearnAudit log activities
  3. 3Microsoft LearnSign-in logs in Microsoft Entra ID
  4. 4Microsoft LearnMicrosoft Entra data retention
  5. 5Microsoft LearnMicrosoft Entra audit log activity reference
  6. 6Google Workspace Admin HelpOAuth log events
  7. 7Google Workspace Admin HelpData retention and lag times
  8. 8Google Workspace Admin HelpUser log events
  9. 9Microsoft LearnMessage trace in the new EAC in Exchange Online
  10. 10Google Workspace Admin HelpGmail log events
  11. 11Microsoft LearnSearch-UnifiedAuditLog
  12. 12Microsoft LearnHow to access activity logs in Microsoft Entra ID
  13. 13Google for DevelopersOAuth Token Audit activity events
  14. 14Microsoft LearnQuickstart: View enterprise applications
  15. 15Google Workspace Admin HelpControl which third-party and internal apps access Google Workspace data
  16. 16Microsoft LearnReview permissions granted to enterprise applications
  17. 17Microsoft LearnConfigure how users consent to applications
  18. 18AegisAIShadow IT and AI discovery
Newsletter

Don't miss the next big threat

New attack write-ups, product changes and practical defence notes, sent when there is something worth reading.