Microsoft 365 Plugin Configuration Guide
This guide explains how to configure Azure Active Directory (Microsoft Entra ID) to allow the ActivityPulse MS365 plugin to authenticate and fetch user activity data.
Prerequisites
- Azure Active Directory tenant with Microsoft 365 subscription
- Global Administrator or Application Administrator role in Azure AD
- Access to the Microsoft Entra admin center (https://entra.microsoft.com)
Overview
The MS365 plugin uses OAuth 2.0 Client Credentials flow to authenticate with Microsoft Graph API. This requires:
- Tenant ID - Your Azure AD tenant identifier
- Client ID - The Application (client) ID of your registered app
- Client Secret - A secret key for authentication
Step 1: Register an Application in Azure AD
1.1 Navigate to App Registrations
- Go to the Microsoft Entra admin center
- Sign in with your administrator account
- In the left navigation, expand Identity > Applications
- Click App registrations
1.2 Create New Registration
- Click + New registration
- Enter the following details:
- Name:
ActivityPulse MS365 Plugin(or your preferred name) - Supported account types: Select Accounts in this organizational directory only (Single tenant)
- Redirect URI: Leave blank (not needed for client credentials flow)
- Click Register
1.3 Note the Application IDs
After registration, you’ll see the Overview page. Note down these values:
| Field | Description | Example |
|---|---|---|
| Application (client) ID | This is your Client ID | abcdef12-3456-7890-abcd-ef1234567890 |
| Directory (tenant) ID | This is your Tenant ID | 12345678-1234-1234-1234-123456789abc |
Step 2: Create a Client Secret
2.1 Navigate to Certificates & Secrets
- In your app registration, click Certificates & secrets in the left menu
- Click the Client secrets tab
2.2 Create New Secret
- Click + New client secret
- Enter a description (e.g.,
ActivityPulse Production) - Select an expiration period:
- Recommended: 24 months (you’ll need to rotate before expiry)
- Note: Microsoft no longer allows “Never” expiration
- Click Add
2.3 Copy the Secret Value
IMPORTANT: Copy the Value immediately. This is your Client Secret.
You will NOT be able to see this value again after leaving this page. If you lose it, you must create a new secret.
| Field | What to copy |
|---|---|
| Value | This is your Client Secret (long string like abc123~...) |
| Secret ID | Not needed for ActivityPulse |
Step 3: Configure API Permissions
3.1 Navigate to API Permissions
- In your app registration, click API permissions in the left menu
- Click + Add a permission
3.2 Add Microsoft Graph Permissions
- Select Microsoft Graph
- Select Application permissions (NOT Delegated permissions)
- Add the following permissions:
Required Permissions
| Permission | Purpose |
|---|---|
Reports.Read.All | Read Teams, Email, OneDrive, and SharePoint activity reports |
Recommended Additional Permissions
| Permission | Purpose |
|---|---|
AuditLog.Read.All | Read sign-in logs (login events) |
Directory.Read.All | Read user information for enrichment |
AuditLogsQuery.Read.All | Read event-level audit logs from all services (tenant-wide). A workload-scoped, least-privilege alternative is documented under AuditLogsQuery.Read.All in the API Permissions Reference below |
Optional Permissions (for Calendar Events)
| Permission | Purpose |
|---|---|
Calendars.Read | Read calendar events (requires additional justification) |
Optional Permissions (for Email Sending via Graph API)
| Permission | Purpose |
|---|---|
Mail.Send | Send email notifications and reports via Microsoft Graph API instead of SMTP |
Note: This permission is only needed if you configure the Microsoft Graph API email transport in Settings > Email. It is not required for data collection.
3.3 How to Add Each Permission
For each permission:
- Click + Add a permission
- Select Microsoft Graph
- Select Application permissions
- Search for the permission name (e.g.,
Reports.Read.All) - Check the box next to it
- Click Add permissions
3.4 Grant Admin Consent
After adding all required permissions:
- Click the Grant admin consent for [Your Organization] button
- Confirm by clicking Yes
- Verify all permissions show a green checkmark under Status
The status should show Granted for [Your Organization] for each permission.
3.5 Additional Permissions for SSO
If you plan to enable Single Sign-On (SSO) so that users can log in to ActivityPulse with their Microsoft account, you will need to configure additional Delegated permissions and a Redirect URI on this same app registration. See the Enabling SSO section in the Configuring ActivityPulse guide for the required permissions and setup steps.
Step 4: Configure ActivityPulse
4.1 Enter Credentials in ActivityPulse
In the ActivityPulse web interface:
- Navigate to Data Sources
- Click Add Data Source or edit an existing MS365 source
- Enter the values you collected:
| Field | Value |
|---|---|
| Tenant ID | Directory (tenant) ID from Step 1.3 |
| Client ID | Application (client) ID from Step 1.3 |
| Client Secret | Secret Value from Step 2.3 |
- Click Test Connection to verify the configuration
- Click Save
4.2 Map Users
For each team member you want to track:
- Navigate to Team > Members
- Edit the team member
- In the External IDs section, add their MS365 identifier
- Enter their User Principal Name (UPN), typically their email address (e.g.,
john.doe@contoso.com)
4.3 Choose which activity to collect
The MS365 source dialog groups activity under Audit Logs (Event-Level) — individual events with precise timestamps. The most useful toggles:
| Toggle | Default | Collects |
|---|---|---|
| Email Events | On | Messages sent (Send, SendAs, SendOnBehalf) |
| File Events | On | File create, modify (including sustained editing sessions), upload, and delete |
| File Read Events | Off | File access, download, and preview. High volume — enable when read activity matters |
| Teams Call Events | On | Call start/end and participant detail |
| Teams Meeting Events | On | Meeting and participant detail |
| Teams Message Events | Off | Individual chat and channel messages. High volume — daily aggregate counts are already collected via usage reports |
| MS365 Auth | On | Interactive sign-in events |
| Sharing Events | Off | Sharing links, secure/company links, and permission grants |
| List Events | Off | SharePoint list and list-item activity |
| Task Events | Off | Planner and Microsoft To Do task activity |
| Forms Events | Off | Microsoft Forms create, respond, and view |
| Viva Engage Events | Off | Viva Engage / Yammer posts and conversation views. High volume |
| Search Events | Off | SharePoint and Exchange search queries |
| Copilot Events | Off | Microsoft 365 Copilot interactions |
Enabling File Read Events also captures page views (PageViewed and
related). All of the off-by-default toggles are opt-in because they can be
high-volume; turn on the ones that matter for the activity picture you want.
Sensitivity note. Some of these sources capture more than activity volume — they capture activity content or passive consumption, and are correspondingly more invasive than the default toggles:
- Search Events record the actual search queries a person typed.
- Copilot Events record Microsoft 365 Copilot interaction content.
- File Read Events (and the page views they include) record passive consumption — what a person opened, downloaded, or viewed, not just what they changed.
Enable these only where you have a documented business need and a lawful basis, and — where your jurisdiction, works council, or employee-consent rules require it — appropriate notice to the people being monitored. They are off by default for this reason as well as for their volume.
Automated activity is never stored. Events produced by service principals or automation agents — for example a Power Automate or Logic Apps flow sending mail as a user — are filtered out at collection time, so they don’t inflate a person’s activity even though the record carries that person’s address.
Verification
Test the Connection
- In ActivityPulse, go to Data Sources
- Find your MS365 data source
- Click Test Connection
- A successful test confirms:
- Tenant ID is valid
- Client ID is correct
- Client Secret is correct
- Required permissions are granted
Verify Data Collection
- Click Sync Now to trigger immediate data collection
- Go to Activities to see fetched activity data
- Note: Microsoft 365 reports are delayed 24-48 hours, so you may not see today’s data immediately
Troubleshooting
”Authentication failed” Error
- Verify Client Secret is copied correctly (no leading/trailing spaces)
- Ensure the secret hasn’t expired
- Confirm Tenant ID and Client ID are GUIDs, not names
”Access denied” Error
- Verify admin consent was granted for all permissions
- Check that permissions are Application type, not Delegated
- Ensure the consenting admin has Global Administrator or Application Administrator role
”Resource not found” Error
- Verify Tenant ID matches your organization
- Confirm your Microsoft 365 subscription includes the services being queried
No Data After Sync
- Reports are delayed 24-48 hours by Microsoft
- Verify team members have MS365 external IDs configured
- Check that users have been active in the services (Teams, Email, etc.)
Rate Limiting Errors
- Microsoft limits report API calls to ~14 requests per 10 minutes per tenant
- ActivityPulse handles this automatically with retry logic
- If persistent, reduce sync frequency
Security Best Practices
Principle of Least Privilege
- Only grant permissions that are actually needed
- Start with
Reports.Read.Allonly - Add
AuditLog.Read.Allif you need login events - For event-level audit data, prefer the workload-scoped
AuditLogsQuery-Exchange.Read.All/AuditLogsQuery-SharePoint.Read.All/AuditLogsQuery-OneDrive.Read.Allpermissions over the tenant-wideAuditLogsQuery.Read.All(see the API Permissions Reference) - Enable content-capturing sources (Search Events, Copilot Events) and passive-consumption sources (File Read Events) only with a documented business need and lawful basis
Secret Management
- Store the client secret securely
- Set calendar reminders to rotate secrets before expiry
- Use a password manager or secrets vault for storage
Monitoring
- Review sign-in logs in Azure AD periodically
- Enable alerts for suspicious app activity
- Monitor the app’s activity in Microsoft Entra admin center
Secret Rotation
Before your client secret expires:
- Create a new client secret (Step 2)
- Update the secret in ActivityPulse
- Verify the connection works
- Delete the old secret from Azure AD
API Permissions Reference
Reports.Read.All
Grants access to:
- Teams user activity reports
- Email activity reports
- OneDrive activity reports
- SharePoint activity reports
Data returned is aggregated per user per day (not individual events).
AuditLog.Read.All
Grants access to:
- Sign-in logs (successful and failed logins)
- Login metadata (app, device, location, IP)
AuditLogsQuery.Read.All
Grants access to:
- Event-level audit logs from the Microsoft Purview Audit Log API
- Individual activity events (file, sharing, Teams message, search, Copilot, and more) with precise timestamps
This is the tenant-wide scope and covers every workload. For least privilege, prefer the workload-scoped permissions instead, granting only the workloads you actually collect from:
| Permission | Covers |
|---|---|
AuditLogsQuery-Exchange.Read.All | Exchange / email audit events |
AuditLogsQuery-SharePoint.Read.All | SharePoint audit events (including file and list activity) |
AuditLogsQuery-OneDrive.Read.All | OneDrive audit events (file activity) |
Granting these three scoped permissions is equivalent to AuditLogsQuery.Read.All
for Exchange, SharePoint, and OneDrive activity. Grant the tenant-wide
AuditLogsQuery.Read.All only if you need event-level data from workloads not
covered above (for example Teams messages, search, or Copilot), or if you prefer
not to maintain the per-workload set.
Directory.Read.All
Grants access to:
- User profile information
- Group membership
- Organizational structure
Calendars.Read
Grants access to:
- Calendar events for all users
- Meeting metadata (subject, attendees, times)
Note: This is a high-privilege permission. Microsoft recommends only requesting it when there is clear business justification.
Mail.Send
Grants access to:
- Sending emails on behalf of any user in the organization
This permission is only required if you use the Microsoft Graph API email transport (configured in Settings > Email). It allows ActivityPulse to send notifications and reports via the Graph API instead of SMTP.