---
title: How do you discover AI agents and apps through identity provider logs?
url: https://opencontroller.lyzr.com/blog/discover-ai-agents-through-identity-provider-logs
published: 2026-11-16
updated: 2026-11-16
author: Lyzr
---

# How do you discover AI agents and apps through identity provider logs?

**Your identity provider already records most AI apps and agents that touch company data, because they have to sign in or ask for consent to do it. Query consent grants, new service principals and app role assignments in Microsoft Entra ID, consent and token events in Okta, and OAuth token events in Google Workspace. Then group the results by app and by the scopes granted.**

Network and cloud scans find agents by where they run. Identity logs find them by what they were allowed to reach. That makes the identity provider one of the cheapest discovery sources you have: no agents to deploy, no traffic to mirror, and the data already sits in your SIEM in many organisations. This guide shows what to query and how to read it. For the full method, see the pillar on [how to find shadow AI agents](/blog/how-to-find-shadow-ai-agents).

## What can identity logs reveal about AI agents?

An AI app or agent leaves identity traces in four ways:

| Trace | What it means | Typical example |
|---|---|---|
| User consent grant | A person let an app act on their behalf with delegated scopes | A meeting-notes assistant reading calendars and mail |
| Admin consent grant | An admin approved scopes for the whole tenant | A sanctioned copilot connector |
| New service principal or app registration | An app identity now exists in your tenant | A team registering an agent to call Microsoft Graph |
| Sign-ins by a workload identity | A non-human identity is actively calling APIs | An agent running on a schedule with client credentials |

The first two tell you about third-party AI apps. The last two tell you about agents your own teams built.

## What should you query in Microsoft Entra ID?

Start with the Entra audit log. These activity names are the useful ones:

- `Consent to application`. The `ConsentContext.IsAdminConsent` field tells you whether it was user or admin consent.
- `Add delegated permission grant`. Records delegated (on-behalf-of) scopes granted to an app.
- `Add app role assignment to service principal`. Records application permissions, which let an app act without a user.
- `Add service principal`. A new app identity appeared in your tenant.

A starting KQL query in Log Analytics or Microsoft Sentinel:

```kusto
AuditLogs
| where TimeGenerated > ago(90d)
| where OperationName in ("Consent to application",
    "Add delegated permission grant",
    "Add app role assignment to service principal",
    "Add service principal")
| extend App = tostring(TargetResources[0].displayName)
| summarize Events = count(), First = min(TimeGenerated),
    Initiators = make_set(tostring(InitiatedBy.user.userPrincipalName))
    by App, OperationName
| order by First desc
```

Then check sign-in logs. Entra splits them into interactive user, non-interactive user, service principal and managed identity sign-ins. Service principal sign-ins show which app identities are active and from which IP ranges. Agents built on Azure often use managed identities, so do not skip that log.

## What should you query in Okta and Google Workspace?

**Okta.** The System Log records consent with the event type `app.oauth2.as.consent.grant`. Query it in the Admin Console or with the System Log API using `filter=eventType eq "app.oauth2.as.consent.grant"`. Then look at token grant events for the same client IDs to see which ones are still active.

**Google Workspace.** The OAuth token audit log in the Admin console records when users authorise third-party apps, which scopes they granted and which app ID received them. The App access control page lists every accessed app with user counts.

In both cases, export to your SIEM so you keep history beyond the console's default retention.

## How do you tell an AI app from any other app?

Identity logs do not label apps as "AI". Use these checks, in order:

1. **Name and publisher.** Match app display names and publisher domains against a maintained list of AI vendors and assistant products.
2. **Scopes.** Broad mail, calendar, file and chat scopes on a recently added app are a strong signal. Read-write mail plus offline access is the riskiest common combination.
3. **Redirect URIs and homepage.** Many AI tools reveal themselves in their reply URLs.
4. **Owner.** For app registrations, check the owner and the team's repos for model SDKs.
5. **Activity pattern.** Agents tend to sign in on regular schedules and from cloud IP ranges, not from user devices.

Record the outcome per app: sanctioned, needs review, or block. For how to triage what you find, see [what to do with a shadow AI agent once you find it](/blog/what-to-do-with-a-shadow-ai-agent-once-you-find-it).

## What will identity logs miss?

Be clear about the gaps:

- **API keys.** An agent that calls a model provider with a static API key never touches your IdP.
- **Personal accounts.** A user who signs up for an AI tool with a personal email leaves no trace in your tenant.
- **Shared service accounts.** Many agents behind one account look like one identity. See [should AI agents share a service account?](/blog/should-ai-agents-share-a-service-account)
- **Retention.** Console retention is limited, so first-time consents from months ago may be gone unless you export.

Pair identity logs with key scanning, egress logs and cloud inventory to close these gaps.

## How Opencontroller does this

Opencontroller auto-discovers agents, models and API keys across AWS, Azure and Google Cloud, and connects to Claude Enterprise and OpenAI Enterprise workspaces and to platforms such as Salesforce, SAP, Databricks and HubSpot. It uses OIDC SSO for its own access and supports delegated on-behalf-of identity and agent workload identity federation. Posture flags risky permissions and configuration on discovered agents, and everything lands in one governed registry. [Book a demo](https://www.lyzr.ai/book-demo/) to see it on your estate.

## Frequently asked questions

**Do I need Microsoft Sentinel to run these Entra queries?**
No. You need the Entra audit and sign-in logs sent to a Log Analytics workspace, or you can pull them with the Microsoft Graph API. Sentinel adds analytics rules and alerting on top.

**Will identity logs find agents that use API keys?**
No. Agents that authenticate with static model-provider keys bypass your identity provider. Use secret scanning and egress logs for those.

**How far back should the first sweep go?**
As far as your retained logs allow, ideally 90 days or more. Many risky consents were granted long before anyone started looking.

## Key facts

Entra audit log activities useful for AI app discovery: Consent to application, Add delegated permission grant, Add app role assignment to service principal, Add service principal. Entra sign-in logs include interactive, non-interactive, service principal and managed identity sign-ins. Okta records user consent as app.oauth2.as.consent.grant. Identity logs miss agents that use static API keys or personal accounts. Opencontroller auto-discovers agents, models and API keys across AWS, Azure and Google Cloud and starts from $250K per deployment per year.

## Related

- [How do you control OAuth consent for AI apps and agents?](https://opencontroller.lyzr.com/blog/control-oauth-consent-for-ai-apps.md)
- [What should you do with a shadow AI agent once you find it?](https://opencontroller.lyzr.com/blog/what-to-do-with-a-shadow-ai-agent-once-you-find-it.md)
- [Should multiple AI agents share one service account?](https://opencontroller.lyzr.com/blog/should-ai-agents-share-a-service-account.md)
- [More on Discovery and shadow agents](https://opencontroller.lyzr.com/blog/cluster/discovery-and-shadow-agents)
