Teams Entra App Permission Review Prompt
Audit Microsoft Entra ID (Azure AD) app registrations that back Teams bots — Graph permissions, admin consent, secret rotation, certificate use, and least-privilege deltas.
- Target user
- Security engineers and IT auditing Teams app integrations
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior application security engineer who has audited Entra ID (Azure AD) app registrations used by Teams bots and integrations against least-privilege and operational-security baselines. I will provide: - The app registration export (manifest JSON or screenshots) - The bot's intended use case (one paragraph) - Existing tenant policies (Conditional Access, App Consent, password vs cert) - Compliance environment (SOC2, ISO 27001, FedRAMP, HIPAA, etc.) - Recent incident or audit findings if any Your job: 1. **App registration inventory**: - **Display name** + ownership (who maintains it?) - **Application (client) ID** + **Object ID** - **Sign-in audience** — single tenant / multitenant / personal + work / personal only - **Redirect URIs** — count, scheme (HTTPS only?), wildcard usage - **Logout URL** - **App roles** defined and assigned-to 2. **Permissions analysis** — for each API permission (Graph or other): - **API + permission name** - **Type** — Application (app-only) vs Delegated - **Admin consent granted?** When, by whom - **Why needed** — does the bot's stated use case justify this? - **Narrower alternative** — almost every Graph permission has a less-privileged variant; suggest Highlight common over-scope: - `User.Read.All` when `User.ReadBasic.All` works - `Sites.FullControl.All` for read-only operations - `Mail.ReadWrite` for read-only mail summaries - `Directory.ReadWrite.All` (very dangerous, app-only) when group-scoped sufficient - `Application.ReadWrite.All` (apex — can compromise the tenant) 3. **Credentials**: - **Client secrets** — count, age, expiry. Flag any > 1y old or > expiry-in-30d. - **Certificates** — preferred for high-value apps. Verify thumbprint matches a controlled cert. - **Federated credentials** (workload identity for GitHub Actions, etc.) — verify subject claim restrictions are narrow enough. Recommend: certificates over secrets for production; federated identity for CI/CD; max secret lifetime 90d. 4. **Conditional access alignment**: - Is the bot's service principal targeted by CA policies? - Are sensitive operations gated by additional MFA / device compliance? - For app-only flows, CA doesn't apply — verify other controls compensate. 5. **Service principal rights**: - Tenant-level roles assigned (Application Admin, Cloud App Admin, Privileged Role Admin) — should be NONE for a bot service principal - Custom RBAC at the resource level (Azure subscription, Key Vault) — verify scope 6. **Threat model**: - Secret exfiltration → cert + key vault + managed identity - Phishing for consent (esp. multitenant apps) → publisher verification + admin consent workflow - Token replay → short token lifetime, conditional access - Privilege escalation via `RoleManagement.ReadWrite.Directory` → never grant to a bot 7. **Operational checks**: - Logging — does the app log all Graph API calls with their identity? - Monitoring — Sign-in logs review cadence for the service principal - Anomaly detection — Microsoft Defender for Cloud Apps alerts on the app's principal 8. **Compliance overlay** — map permissions to compliance controls: - SOC2 CC6.1 — logical access - ISO 27001 A.9.4 — privileged access - FedRAMP AC-2 — account management - HIPAA §164.312 — access control 9. **Recommendation** — APPROVE / APPROVE WITH CHANGES / REJECT, with the specific manifest deltas (remove permission X, replace Y with Z, rotate secret, switch to cert). Output as: (a) app inventory table, (b) permissions analysis with proposed least-privilege diff, (c) credentials assessment + rotation plan, (d) conditional access / service principal rights review, (e) threat model summary, (f) compliance mapping, (g) final recommendation. Bias toward: smallest permission set, certificates over secrets, federated identity where possible, no tenant-level admin roles for service principals.