Overview
Microsoft Graph API integration allows you to collect security events related to your Microsoft Graph services. This integration provides deeper insights into Microsoft cloud services beyond what Office 365 monitoring offers, including advanced threat protection, identity protection, and security scores. Reference:plugins/main/common/wazuh-modules.ts:73
What is Microsoft Graph API?
Microsoft Graph is the unified API endpoint for accessing Microsoft 365, Windows 10, and Enterprise Mobility + Security services. It provides a unified programmability model for accessing data across:- Azure Active Directory
- Microsoft 365 services
- Windows 10 services
- Enterprise Mobility + Security
- Security and threat intelligence
Key Features
- Unified security event collection
- Advanced threat detection events
- Identity protection alerts
- Security score monitoring
- Incident and alert management
- Threat intelligence integration
- User risk detection
- Sign-in risk analysis
- Conditional access policy monitoring
Collected Security Events
The Microsoft Graph API integration collects:Security Alerts
- Microsoft Defender Alerts - Endpoint protection events
- Azure AD Identity Protection - User and sign-in risk events
- Cloud App Security - Cloud application threats
- Azure Security Center - Infrastructure security alerts
- Office 365 ATP - Advanced Threat Protection events
Identity and Access Events
- User risk detections
- Sign-in risk detections
- Risky users
- Risk events
- Conditional access failures
- Authentication methods changes
Threat Intelligence
- Threat indicators (IPs, URLs, domains, files)
- Threat assessment requests
- Security scores
- Secure score control profiles
Incidents
- Security incidents
- Incident assignments
- Incident status changes
- Investigation findings
Setup and Configuration
Prerequisites
- Microsoft 365 E5 or Azure AD Premium P2 license
- Azure AD Global Administrator or Security Administrator role
- Azure AD application registration
- Wazuh manager configured for Microsoft Graph integration
Configuration Steps
-
Register Azure AD Application
- Sign in to Azure Portal (https://portal.azure.com)
- Navigate to Azure Active Directory > App registrations
- Click “New registration”
- Name: “Wazuh Microsoft Graph Integration”
- Account type: “Accounts in this organizational directory only”
- Click Register
-
Configure API Permissions
Add Microsoft Graph API permissions (Application permissions):
Security Alerts:
SecurityEvents.Read.AllSecurityAlert.Read.AllThreatIndicators.Read.All
IdentityRiskEvent.Read.AllIdentityRiskyUser.Read.All
Directory.Read.AllUser.Read.All
-
Create Client Secret
- In the app registration, go to Certificates & secrets
- Click “New client secret”
- Description: “Wazuh Integration Secret”
- Expiration: Choose appropriate duration
- Click Add and copy the secret value
-
Gather Configuration Information
Note the following from your app registration:
- Application (client) ID
- Directory (tenant) ID
- Client secret value
-
Configure Wazuh Manager
Edit
/var/ossec/etc/ossec.conf: -
Verify Configuration
- Restart Wazuh manager:
systemctl restart wazuh-manager - Check logs:
tail -f /var/ossec/logs/ossec.log - Look for successful Microsoft Graph API connections
- Verify events appear in Wazuh Dashboard
- Restart Wazuh manager:
Available Resources
The integration can query various Microsoft Graph resources:Security Resource
alerts- Security alerts from various providerssecureScores- Microsoft Secure Score over timesecureScoreControlProfiles- Security control detailsincidents- Security incidentsalerts_v2- Next-generation security alerts
Identity Protection
riskDetections- Risk detections for users and sign-insriskyUsers- Users flagged as at-riskservicePrincipalRiskDetections- Service principal risk events
Threat Intelligence
tiIndicators- Threat intelligence indicators
Event Fields
Microsoft Graph events include rich metadata:Alert Fields
title- Alert titleseverity- High, Medium, Low, Informationalcategory- Alert categorystatus- New, InProgress, Resolvedprovider- Alert provider (Azure ATP, MCAS, etc.)vendorInformation- Provider detailsassignedTo- User assigned to alertconfidence- Confidence score (0-100)riskScore- Risk score
User Risk Fields
userPrincipalName- User identifierriskLevel- Low, Medium, HighriskState- Active, Remediated, DismissedriskDetail- Risk reasonriskLastUpdatedDateTime- Last update time
Filtering Events
Filter Microsoft Graph events in the dashboard:- By severity:
data.ms-graph.severity: "high" - By category:
data.ms-graph.category: "malware" - By status:
data.ms-graph.status: "new" - By provider:
data.ms-graph.provider: "Azure ATP"
Use Cases
Advanced Threat Detection
-
Credential Theft Detection
- Password spray attacks
- Leaked credentials usage
- Anonymous IP address sign-ins
-
Malware and Phishing
- Malicious file downloads
- Phishing email detection
- Suspicious URL access
-
Anomalous Behavior
- Impossible travel
- Atypical sign-in properties
- Unfamiliar sign-in locations
Identity Protection
-
Risk-Based Access Control
- Monitor risky sign-ins
- Track user risk levels
- Conditional access policy enforcement
-
Account Compromise Prevention
- Leaked credential alerts
- Anonymous IP usage
- Malware-infected devices
Security Posture Management
-
Secure Score Monitoring
- Track security score trends
- Monitor control improvements
- Identify security gaps
-
Compliance Tracking
- Security control compliance
- Recommendation implementation
- Risk mitigation progress
Incident Response
-
Incident Investigation
- Related alert correlation
- User activity analysis
- Attack timeline reconstruction
-
Threat Hunting
- Indicator of Compromise (IoC) searching
- Cross-service correlation
- Historical pattern analysis
Common Alert Categories
- Credential Access - Password attacks, credential theft
- Malware - Malicious software detection
- Phishing - Phishing attempts and campaigns
- Suspicious Activity - Anomalous behavior
- Initial Access - Unauthorized access attempts
- Exfiltration - Data theft indicators
- Lateral Movement - Internal network propagation
- Command and Control - C2 communication
Troubleshooting
Authentication Issues
-
Error: Invalid client secret
- Verify client secret is correct
- Check if secret has expired
- Generate new secret if needed
-
Error: Insufficient permissions
- Verify API permissions are configured
- Ensure admin consent was granted
- Check application permissions (not delegated)
No Events Appearing
- Verify Microsoft 365 E5 or appropriate license is active
- Check if security features are enabled
- Confirm Azure AD Identity Protection is configured
- Verify resources are specified correctly in configuration
- Review Wazuh manager logs for API errors
Performance Issues
- Adjust polling interval based on alert volume
- Limit resources to only required endpoints
- Monitor API throttling limits
- Increase
curl_max_sizefor large responses
Missing Specific Alert Types
- Verify the security product is configured (Defender, MCAS, etc.)
- Check license includes the specific feature
- Confirm alert provider is enabled
- Review Microsoft 365 security center configuration
Security Best Practices
-
Application Security
- Use application permissions, not delegated
- Implement certificate-based authentication for production
- Rotate client secrets regularly
- Monitor application sign-in logs
-
Least Privilege
- Grant only required Graph API permissions
- Use separate app registrations for different integrations
- Regular permission audits
-
Monitoring
- Alert on integration authentication failures
- Track API call patterns
- Monitor for unusual data access
- Log all configuration changes
-
Data Protection
- Secure storage of credentials
- Encrypt credentials in Wazuh configuration
- Implement network restrictions
- Use Azure Key Vault for secrets
Advanced Configuration
Multiple Resources
Query multiple Graph resources:Filtering by Severity
Collect only high-severity alerts:Date Filtering
Query recent events only:Microsoft Graph API Versions
The integration supports:- v1.0 - Production-ready, stable APIs
- beta - Preview APIs with latest features (may change)
Rate Limits and Throttling
Microsoft Graph API has throttling limits:- Monitor 429 (Too Many Requests) responses
- Implement exponential backoff
- Adjust polling intervals to stay within limits
- Use webhooks for real-time events (advanced)