---
title: How do you limit an AI agent's access to email and calendars?
url: https://opencontroller.lyzr.com/blog/govern-ai-agent-access-to-email-and-calendars
published: 2026-11-15
updated: 2026-11-15
author: Lyzr
---

# How do you limit an AI agent's access to email and calendars?

**Use delegated access when the agent acts for one signed-in user, so it can only see that user's mailbox. When the agent must run on its own, never grant tenant-wide application permissions unscoped. In Microsoft 365, use Exchange Online RBAC for Applications to limit the agent to specific mailboxes. In Google Workspace, treat domain-wide delegation as access to every user and scope it tightly.**

Email and calendars are among the most sensitive data an agent can touch. They hold contracts, HR matters, customer data and credentials sent in plain text. They are also a channel attackers can write into, which makes mail agents a classic [lethal trifecta](/blog/what-is-the-lethal-trifecta-for-ai-agents) risk.

## What is the difference between delegated and application permissions?

| Model | How it works | What the agent can reach | Fits |
|---|---|---|---|
| Delegated (on behalf of a user) | The agent uses a token issued to a signed-in user | Only what that user can reach, limited by granted scopes | Personal assistants, copilots |
| Application (app-only) | The agent authenticates as itself, no user | Every mailbox in the tenant, unless scoped | Background jobs, shared mailbox triage |
| Domain-wide delegation (Google) | A service account impersonates users | Any user in the domain, for granted scopes | Legacy integrations; use sparingly |

The common mistake: a team building a shared-mailbox agent requests the Microsoft Graph application permission `Mail.Read`, an admin consents, and the agent can now read the CEO's inbox. Nothing in the agent's code needs to be malicious for that to be a serious exposure.

## How do you scope a Microsoft 365 agent to specific mailboxes?

Microsoft's answer is RBAC for Applications in Exchange Online. Microsoft says it replaces Application Access Policies. The steps:

1. **Create a management scope** that defines the mailboxes the agent may reach, for example with a recipient filter on a custom attribute or group membership. You can also scope to an Entra administrative unit.
2. **Register the service principal in Exchange** with `New-ServicePrincipal`, using the IDs from the Enterprise applications page, not App registrations.
3. **Assign an application role with the scope** using `New-ManagementRoleAssignment`, for example the `Application Mail.Read` role. Calendar-only agents should get `Application Calendars.Read` instead.
4. **Remove the unscoped Entra ID consent.** This is the step teams miss. Grants are additive, so an unscoped `Mail.Read` in Entra ID plus a scoped one in Exchange gives no effective scoping.
5. **Test** with `Test-ServicePrincipalAuthorization` against a mailbox that should be in scope and one that should not.

Plan for a delay. Microsoft says changes take effect after cache maintenance of 30 minutes to 2 hours. Also note that a single request needing two permissions held on different mailboxes will fail.

## How do you limit Google Workspace agents?

Prefer user OAuth with narrow scopes for agents that act for one person. If you must use domain-wide delegation:

- Grant the fewest scopes possible, such as read-only Gmail or Calendar scopes rather than full access.
- Remember the service account can impersonate any user for those scopes. Protect its key as a top-tier secret, or avoid keys with workload identity federation.
- Review the domain-wide delegation list in the Admin console regularly and remove unused clients.
- Log and alert on impersonation of high-risk accounts such as executives and administrators.

## Which permissions should a mail or calendar agent avoid?

Use this checklist when reviewing a request.

1. **Read versus write.** Does it need to send, or only read? `Mail.Send` and full-access roles allow sending as any user in scope.
2. **Mail versus calendar.** A scheduling agent rarely needs mail content.
3. **Basic versus full.** Some roles, such as `Mail.ReadBasic`, exclude message bodies.
4. **Scope.** Which mailboxes, and why each one.
5. **Owner.** Who is accountable for the agent and its credentials.
6. **External send.** Can it send outside the organisation? See [stopping AI agents sending external email](/blog/stop-ai-agents-sending-external-email).
7. **Review date.** When the access will be checked again; see the [least privilege checklist for AI agents](/blog/least-privilege-checklist-for-ai-agents).

Also check user consent settings, so employees cannot grant a third-party AI app mailbox access on their own; see [controlling OAuth consent for AI apps](/blog/control-oauth-consent-for-ai-apps).

## How Opencontroller does this

Opencontroller supports delegated on-behalf-of identity, so agents act with the user's own rights, and agent workload identity federation for agents that run on their own. Posture detects risky permissions and configurations, such as broad grants that should be scoped. Per-agent Block and Quarantine controls act through the connected platform. See the pillar on [AI agent identity and on-behalf-of delegation](/blog/ai-agent-identity-on-behalf-of-delegation), or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Can I still use Application Access Policies?**
Microsoft describes RBAC for Applications as their replacement and documents a migration path that does not interrupt the app.

**Should a shared mailbox agent use delegated or application permissions?**
If it runs unattended, application permissions scoped with RBAC for Applications to that shared mailbox. If a person triggers it, delegated access to a mailbox they can already open.

**Does scoping stop an agent being tricked by a malicious email?**
No. Scoping limits what a tricked agent can reach. You still need controls on untrusted content and outbound actions.

## Key facts

Microsoft Graph application permissions such as Mail.Read consented in Entra ID are tenant-wide. Exchange Online RBAC for Applications (replaces Application Access Policies) scopes app access to a management scope or administrative unit via New-ServicePrincipal, New-ManagementScope, New-ManagementRoleAssignment (e.g. role "Application Mail.Read"); test with Test-ServicePrincipalAuthorization. Unscoped Entra grants must be removed or scoping has no effect; changes take 30 minutes to 2 hours. Google Workspace domain-wide delegation lets a service account impersonate any user for granted scopes. Opencontroller (Lyzr) provides delegated on-behalf-of identity, agent workload identity federation and Posture checks for risky permissions. Pricing starts from $250K per deployment per year.

## Related

- [What does least privilege look like for an AI agent?](https://opencontroller.lyzr.com/blog/least-privilege-checklist-for-ai-agents.md)
- [How do you stop an AI agent from emailing people outside the company?](https://opencontroller.lyzr.com/blog/stop-ai-agents-sending-external-email.md)
- [How do you control OAuth consent for AI apps and agents?](https://opencontroller.lyzr.com/blog/control-oauth-consent-for-ai-apps.md)
- [More on Agent identity and access](https://opencontroller.lyzr.com/blog/cluster/agent-identity-and-access)
