Generate a Weekly VIP/Admin Sign-In Anomaly Report

Prev Next

Detect unusual sign-in patterns for privileged and executive accounts in Microsoft 365.

Complexity: Intermediate. Impact: security + compliance + monitoring + privileged-access + reporting.

Why use this workflow

VIP accounts (executives, board members) and privileged admin accounts are high-value targets in any Microsoft 365 tenant. Attackers routinely use password spray, credential stuffing, and session hijacking against these identities, and a single compromise can lead to tenant-wide impact.

A weekly sign-in anomaly report gives your security team a rhythm for catching early-stage attacks: repeated failures, impossible-travel events, sign-ins from unfamiliar geographies, and abnormal activity frequency, before they escalate into incidents. Running this on a schedule (rather than only reacting to alerts) provides coverage of low-and-slow attacks that might not trigger Conditional Access or Identity Protection in real time.

Run this workflow every Monday morning as part of your security operations cadence, or any time after a known threat campaign that targets executives.

Expected outcomes

  • A consolidated list of all directory role holders (admins) and members of VIP, Executive, or Leadership groups
  • Sign-in log analysis for each VIP and admin covering the past 7 days
  • Anomaly flags: repeated failed sign-ins, sign-ins from new countries, sign-ins outside business hours, and sign-ins at abnormal frequency
  • A prioritized list of accounts that require follow-up (password reset, session revoke, MFA re-registration, or user contact)
  • A CSV or HTML report suitable for sharing with the security team and leadership

Risks and considerations

Compliance and privacy

  • Sign-in logs contain IP addresses and location data. Treat the report as confidential and store it in a controlled location.
  • Some jurisdictions (for example the EU, under GDPR) require that access to employee sign-in data be logged and justified.

Operational gotchas

  • AuditLog.Read.All is a sensitive permission. Grant it only to a dedicated service principal or reporting account, never to an interactive user unnecessarily.
  • Sign-in logs are retained for 30 days on Entra ID P1 or P2 licenses. Tenants on the free tier retain 7 days.
  • "Unfamiliar location" is subjective. Baseline at least 30 days of sign-in history before you flag first-seen countries as anomalous, or you get false positives for business travelers.
  • Service accounts and break-glass accounts may appear as anomalies by design. Maintain an allow-list.

What not to do

  • Do not auto-disable accounts based on this report. Always have a human confirm before taking account actions on executives.
  • Do not email the raw report to distribution lists. It is a disclosure risk.

Required permissions

PermissionWhy it's needed
RoleManagement.Read.DirectoryList members of directory roles (Global Administrator, Security Administrator, and so on) to identify privileged accounts
Group.Read.AllEnumerate VIP, Executive, and Leadership groups and their members
AuditLog.Read.AllRead sign-in logs to analyze authentication patterns and failures
User.Read.AllResolve user details (display name, UPN, department) for the report

Ask Dex

Paste the prompt into a Dex conversation.

Prompt for IT admins

Generate a weekly sign-in anomaly report for all VIP and admin accounts. Pull the last 7 days of sign-ins, flag accounts with repeated failures, unfamiliar locations, or abnormal frequency, and recommend follow-up actions (reset password, revoke sessions, contact user) for each flagged account.

Manual steps (admin center)

This path produces the report section by section. For full automation, use the API or PowerShell approach.

Step 1: Identify admin accounts

  1. Sign in to the Microsoft Entra admin center as a Security Reader or Global Reader.
  2. Go to Identity > Roles & admins > All roles.
  3. For each privileged role (Global Administrator, Privileged Role Administrator, Security Administrator, Exchange Administrator, SharePoint Administrator, User Administrator), select the role and export the member list.
  4. Consolidate the results into a single spreadsheet of admin UPNs.

Step 2: Identify VIP group members

  1. Go to Identity > Groups > All groups.
  2. Search for groups that contain "VIP", "Executive", or "Leadership".
  3. Open each group and export the members. Add the UPNs to the same spreadsheet.

Step 3: Review sign-in logs per account

  1. Go to Identity > Monitoring & health > Sign-in logs.
  2. Set the date range to Last 7 days.
  3. Add the filter User = {vip_upn}.
  4. For each VIP or admin, review:
    • Status column: count Failure entries and compare against your failure threshold
    • Location column: note any new countries versus the usual pattern
    • IP address: look for datacenter, VPN, or Tor exit ranges
    • The User sign-ins (non-interactive) tab, to catch token replay activity
  5. Export each filtered view as CSV.

Step 4: Compile and recommend

  1. For any account with flags, recommend a password reset, revoking all sessions (Users > {user} > Revoke sessions), MFA re-registration, or direct contact with the user.
  2. Save the report to your security team's secure location.

The manual path becomes impractical when you have many VIP and admin accounts. Use PowerShell instead.

Microsoft Graph API

The report assembly involves four API calls: enumerate roles, enumerate VIP groups, pull sign-in logs, and correlate.

1. List all directory role members (admins)

GET https://graph.microsoft.com/v1.0/directoryRoles?$expand=members($select=id,displayName,userPrincipalName)

The response contains one entry per activated role with a members collection. Flatten and dedupe by userPrincipalName.

2. Find VIP and Executive groups and their members

GET https://graph.microsoft.com/v1.0/groups?$filter=contains(displayName,'VIP') or contains(displayName,'Executive') or contains(displayName,'Leadership')&$select=id,displayName

Then for each group ID:

GET https://graph.microsoft.com/v1.0/groups/{group_id}/members?$select=id,displayName,userPrincipalName

3. Query sign-in logs for the past 7 days

Use a filter that scopes to the target UPN and a 7-day window:

GET https://graph.microsoft.com/v1.0/auditLogs/signIns?$filter=userPrincipalName eq '{upn}' and createdDateTime ge {iso_7_days_ago}&$top=1000

Key fields to inspect in each sign-in record:

  • status.errorCode: non-zero means failure
  • location.countryOrRegion and location.city
  • ipAddress
  • riskLevelAggregated and riskState (requires Entra ID P2)
  • clientAppUsed and deviceDetail

4. Apply anomaly rules

Aggregate per user and flag when, for example (tune the thresholds to your tenant):

  • The failed sign-in count in the window passes your failure threshold
  • countryOrRegion was not seen in the prior 30 days for that user
  • Sign-ins occur outside the user's normal local working hours
  • riskLevelAggregated = medium or high

Example anomaly response (simplified)

{
  "user": "ceo@contoso.com",
  "failures_7d": 12,
  "new_countries": ["RU", "CN"],
  "risky_signins": 2,
  "recommendation": "Revoke sessions, reset password, contact user"
}

Required application permissions: RoleManagement.Read.Directory, Group.Read.All, AuditLog.Read.All, and User.Read.All. Grant admin consent before the first run.

PowerShell

The Microsoft Graph PowerShell module handles authentication, paging, and JSON parsing, which suits a weekly scheduled task.

Prerequisites

Install-Module Microsoft.Graph -Scope CurrentUser

Connect with the right scopes

Connect-MgGraph -Scopes "RoleManagement.Read.Directory","Group.Read.All","AuditLog.Read.All","User.Read.All"

Approach

  1. Enumerate all active directory roles and collect member UPNs.
  2. Find groups whose display name matches your VIP, Executive, or Leadership keywords.
  3. For each VIP or admin UPN, pull sign-in logs for the last 7 days with Get-MgAuditLogSignIn.
  4. Apply anomaly rules: failure count, new countries against a 30-day baseline, and risky sign-ins.
  5. Produce a CSV and an HTML report with a recommendations column.

Scheduling

Run the approach on a weekly schedule (Azure Automation, Task Scheduler, or a pipeline). Write the CSV (raw data) and the HTML (executive summary) to a controlled location, with the date in the file names.