Configure Diagnostic Settings
Earn 25 points (50 with Pro) in two steps
- ① Read through the lesson — each section gets a ✓ as you scroll through it.
- ② When every section has a ✓, tap Complete lesson.
0 of 12 read · keep scrolling
✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro
Configuring Diagnostic Settings in Microsoft Entra ID
Introduction: Why Identity Monitoring Matters
In the modern digital workplace, identity is the new perimeter. Organizations no longer rely solely on firewalls to protect their resources; instead, they rely on the ability to verify who is accessing what, at what time, and from where. Microsoft Entra ID (formerly Azure Active Directory) sits at the center of this strategy. However, simply having an identity provider is not enough. You must have visibility into the events, anomalies, and administrative actions occurring within that environment. This is where diagnostic settings come into play.
Diagnostic settings are the mechanism by which you export logs from Microsoft Entra ID to external destinations. By default, Entra ID retains sign-in and audit logs for a limited period—typically 30 days for standard tiers. If an attacker gains access to your environment and remains dormant for a month, or if you need to conduct a forensic investigation into an event that happened six months ago, the default logs will be gone. Configuring diagnostic settings allows you to take control of your data retention, perform long-term trend analysis, and integrate your identity logs with security information and event management (SIEM) systems.
Without a robust logging strategy, you are essentially blind to the "who, what, and when" of your organization’s identity lifecycle. You cannot detect credential stuffing attacks, unauthorized administrative changes, or suspicious service principal behavior if you aren't capturing the data in a persistent location. This lesson will guide you through the technical implementation of diagnostic settings, the architectural choices you need to make, and the best practices for maintaining a secure and compliant logging environment.
Not read yet
Understanding the Data Streams in Entra ID
Before diving into the configuration, it is vital to understand what kind of data you are actually capturing. Entra ID categorizes its logs into several distinct streams. When you configure a diagnostic setting, you are choosing which of these streams to send to your destination.
1. Audit Logs
The Audit log provides traceability for all changes made within your tenant. This includes user management tasks (like adding a user to a group), application registrations, policy updates, and configuration changes to conditional access policies. If a setting in your tenant changes, it will be recorded here. This is your primary source for "who did what" investigations.
2. Sign-in Logs
Sign-in logs provide a detailed history of every time a user or service principal attempts to access your resources. This includes interactive sign-ins, non-interactive sign-ins (used by applications), and managed identity sign-ins. These logs contain critical metadata such as the IP address, device information, conditional access status, and the specific application being accessed.
3. Provisioning Logs
These logs are specific to automated identity lifecycle management. If you use Entra ID to provision users into third-party applications (like Salesforce or ServiceNow), the provisioning logs track the success or failure of those sync operations. They are essential for troubleshooting synchronization issues between your identity provider and connected SaaS apps.
4. Risky Users and User Risk Events
These logs are generated by Entra ID Protection. They track signals that suggest a user account may have been compromised, such as impossible travel, leaked credentials, or sign-ins from suspicious IP addresses. Monitoring these is critical for proactive security.
Callout: Diagnostic Settings vs. Log Analytics It is common to confuse the setting with the destination. The diagnostic setting is the "pipe" that moves the data. The destination (such as a Log Analytics Workspace or an Azure Storage Account) is the "bucket" that holds the data. You must configure the pipe to point to the bucket before you can begin querying your identity data.
Not read yet
Choosing Your Destination Architecture
When you enable diagnostic settings, you have three primary destinations for your logs. Each serves a different purpose, and many organizations use a combination of them to balance cost, performance, and accessibility.
Log Analytics Workspace
This is the most common destination for security teams. By sending logs to a Log Analytics Workspace, you enable the use of Kusto Query Language (KQL). KQL allows you to perform complex, high-speed queries across millions of log entries. This is the foundation for creating workbooks, alerts, and dashboards.
Azure Storage Account
If your primary concern is long-term archival for compliance (for example, keeping logs for seven years to meet regulatory requirements), an Azure Storage Account is the most cost-effective solution. You can set up lifecycle management policies to move older logs to cooler storage tiers or delete them after a specific period. However, querying data directly from a storage account is significantly slower and more difficult than using Log Analytics.
Event Hubs
Event Hubs are used for real-time streaming to third-party SIEM solutions like Splunk, IBM QRadar, or ArcSight. If your organization has a centralized Security Operations Center (SOC) that does not use Azure-native tools, you would stream your Entra ID logs into an Event Hub, which then acts as a broker to pass that data to your external SIEM.
Not read yet
Step-by-Step: Configuring Diagnostic Settings
Configuring these settings is a straightforward process, but it requires the correct permissions (Global Administrator or Security Administrator). Follow these steps to configure your logging pipeline.
Step 1: Create a Destination
Before configuring the setting, ensure your destination exists. If you are using Log Analytics, navigate to "Log Analytics workspaces" in the Azure portal and create a new workspace if one does not already exist.
Step 2: Access Entra ID Diagnostic Settings
- Sign in to the Microsoft Entra admin center.
- Navigate to Identity > Monitoring & health > Diagnostic settings.
- Click + Add diagnostic setting.
Step 3: Configure the Settings
- Name: Give your setting a descriptive name (e.g., "EntraID-to-LogAnalytics").
- Categories: Select the logs you want to stream. It is standard practice to select
AuditLogs,SignInLogs,NonInteractiveUserSignInLogs,ServicePrincipalSignInLogs, andManagedIdentitySignInLogs. - Destination details: Check the box for "Send to Log Analytics workspace." Select your subscription and the workspace you created in Step 1.
- Save: Click the Save button at the top.
Tip: Monitor for Cost Streaming logs into Log Analytics incurs ingestion costs. If you are a large organization with millions of daily sign-ins, ensure you are monitoring your workspace usage. You can use the "Cost Management + Billing" section in the Azure portal to set up budgets and alerts for your Log Analytics workspace to avoid unexpected monthly charges.
Not read yet
Automating Configuration with PowerShell
For organizations managing multiple tenants or those that prefer "Infrastructure as Code," manual configuration is not scalable. You can use the Az PowerShell module to automate the creation of diagnostic settings.
# Connect to your Azure account
Connect-AzAccount
# Define variables
$workspaceId = "/subscriptions/{sub-id}/resourceGroups/{rg}/providers/Microsoft.OperationalInsights/workspaces/{workspace-name}"
$diagnosticSettingName = "EntraID-Logging-Automation"
# Get the Entra ID Diagnostic Settings resource
$resourceId = (Get-AzADDiagnosticSetting -Name "dummy").ResourceId # Note: You usually target the tenant root
# Create the diagnostic setting
New-AzDiagnosticSetting -Name $diagnosticSettingName `
-ResourceId "/providers/microsoft.aad/tenants/{tenant-id}" `
-WorkspaceId $workspaceId `
-Category AuditLogs, SignInLogs, NonInteractiveUserSignInLogs `
-Enabled $true
Explanation of the script:
- We define the
workspaceIdto point to the specific Log Analytics instance. - The
ResourceIdmust point to the root of the Entra ID tenant. - We specify the categories we want to enable. By explicitly listing them, we ensure we are not collecting unnecessary data that could inflate our costs.
Not read yet
Best Practices for Identity Logging
Implementing diagnostic settings is only the first step. To truly derive value from your logs, you must follow industry-standard practices.
1. Centralize Your Logs
Do not rely on the default 30-day retention in the Entra ID portal. Always ensure logs are flowing to a centralized Log Analytics workspace. This allows you to correlate identity logs with logs from other Azure resources (like Key Vault or SQL Databases).
2. Implement Retention Policies
In your Log Analytics workspace, configure the data retention period. By default, it might be 30 days. You should increase this based on your internal compliance requirements (e.g., 90 days, 1 year, or longer). Remember that increasing retention increases cost.
3. Use Workbooks for Visualization
Raw logs are difficult to read. Use Microsoft Entra Workbooks to visualize your data. Workbooks allow you to create charts showing sign-in trends, failed authentication spikes, and administrative activity. You can pin these to a dashboard for at-a-glance monitoring.
4. Set Up Proactive Alerts
Logging is useless if you aren't alerted when something goes wrong. Create alert rules in Log Analytics for critical events.
- Example: Create an alert for when a user is added to a Privileged Role (e.g., Global Admin).
- Example: Create an alert for a high volume of failed sign-in attempts from a single IP address (a sign of a brute-force attack).
5. Filter Out Noise
Not every log entry is useful. If you have service accounts that generate millions of non-interactive sign-ins, you might want to filter those out of your primary security dashboard to reduce noise. However, be careful—filtering at the source means you lose that data for future investigations.
Not read yet
Common Pitfalls and How to Avoid Them
Even experienced administrators make mistakes when configuring diagnostic settings. Here are the most frequent issues and how to steer clear of them.
Pitfall 1: Assuming Logs are Enabled by Default
Many administrators assume that because the logs appear in the Entra ID portal, they are being saved permanently. This is a dangerous assumption. Once the 30-day window passes, the data is purged from the portal. You must configure the diagnostic setting to ensure data persists.
Pitfall 2: Neglecting Service Principal Logs
Most security teams focus on user sign-ins. However, attackers frequently target service principals because they often have high-level permissions and rarely trigger MFA prompts. Ensure you are capturing ServicePrincipalSignInLogs and ManagedIdentitySignInLogs.
Pitfall 3: Ignoring Log Ingestion Latency
While logs usually appear in Log Analytics within a few minutes, there can be delays. Do not build real-time automated response systems (like automatically disabling an account) based solely on log ingestion, as the latency can lead to false negatives.
Pitfall 4: Over-retention
Keeping every single log for 10 years is a common compliance request, but it is expensive. Use tiered storage. Keep the last 90 days in "hot" Log Analytics storage for fast querying, and use "Archive" or "Storage Account" tiers for older logs that you only need to access for infrequent audits.
Warning: Data Privacy and Compliance Be aware of what information is stored in your logs. Entra ID logs may contain IP addresses, user principal names, and device IDs. Depending on your jurisdiction (e.g., GDPR in Europe), this may be classified as Personal Identifiable Information (PII). Ensure your storage locations are compliant with your organization’s data privacy policies.
Not read yet
Comparison Table: Monitoring Options
| Feature | Entra ID Portal | Log Analytics | Azure Storage |
|---|---|---|---|
| Retention | 30 Days (Fixed) | Configurable | Indefinite |
| Query Speed | Moderate | Fast (KQL) | Slow |
| Cost | Included | Ingestion/Retention Fees | Storage Fees |
| Best For | Ad-hoc checks | Security analysis/Alerting | Long-term compliance |
| Visualization | Limited | High (Workbooks) | None |
Deep Dive into KQL for Identity Logs
Once you have your diagnostic settings configured and data is flowing into Log Analytics, you need to know how to query it. KQL is the language used to extract insights. Here are three essential queries every identity administrator should have in their toolkit.
Query 1: Find Unauthorized Administrative Actions
This query looks for any user who was added to a sensitive role, identifying who performed the action and when.
AuditLogs
| where OperationName contains "Add member to role"
| project TimeGenerated, InitiatedBy, TargetResources, OperationName
| order by TimeGenerated desc
Query 2: Detect Brute Force Attempts
This query looks for a specific user account that has had a high number of failed sign-in attempts in a short timeframe.
SigninLogs
| where ResultType != 0
| summarize FailedCount = count() by UserPrincipalName, IPAddress, bin(TimeGenerated, 5m)
| where FailedCount > 10
| order by FailedCount desc
Query 3: Monitor Service Principal Usage
This helps you identify which applications are accessing your tenant and how often.
ServicePrincipalSignInLogs
| summarize Count = count() by AppDisplayName, ResultType
| order by Count desc
Explanation:
AuditLogsandSigninLogsare the tables where your data lives.summarizeis used to aggregate data, which is essential for spotting patterns.bin(TimeGenerated, 5m)breaks the logs into 5-minute chunks, making it easier to spot spikes in activity.
Not read yet
Integrating with SIEM Systems
While Log Analytics is excellent for Azure-native environments, many enterprises use a dedicated SIEM (Security Information and Event Management) system like Splunk or Sentinel.
If you are using Microsoft Sentinel, the integration is native. Since Sentinel is built on top of Log Analytics, you simply configure your diagnostic settings to send logs to the same workspace where Sentinel is enabled.
If you are using a third-party SIEM, the workflow is:
- Diagnostic Settings: Send logs to an Azure Event Hub.
- Event Hub: Acts as a buffer to hold the logs.
- SIEM Connector: Your SIEM (e.g., Splunk) uses a dedicated connector to pull the logs from the Event Hub.
This architecture ensures that your security team can correlate identity data from Entra ID with network traffic, endpoint logs, and application logs from across the entire enterprise, regardless of whether those resources live in Azure or on-premises.
Not read yet
Governance and Maintenance
Configuration is not a "set it and forget it" task. Over time, your environment will change. New applications will be added, and administrative roles will be modified.
Quarterly Reviews
Establish a process to review your diagnostic settings every quarter. Ask the following questions:
- Are we capturing all the logs we need?
- Have we added new applications that require specific logging?
- Is our Log Analytics workspace reaching its capacity or budget limits?
- Are the alerts we configured still relevant, or are they generating too many false positives?
Role-Based Access Control (RBAC)
Ensure that access to the logs themselves is restricted. Just because a user is a Global Admin does not mean they need access to the logs. Use RBAC to grant "Log Analytics Reader" roles only to the security team members who actually need to perform investigations. This follows the principle of least privilege.
Auditing the Audit Logs
It is possible for an attacker to try and disable diagnostic settings to hide their tracks. You should create an alert that triggers if a diagnostic setting is modified or deleted. This is a critical security control that ensures the integrity of your monitoring pipeline.
Not read yet
Common Questions (FAQ)
Q: Does enabling diagnostic settings impact the performance of Entra ID? A: No. The logging process happens asynchronously in the background. It does not affect the performance of user sign-ins or administrative operations.
Q: Can I send logs to multiple destinations? A: Yes. You can configure a single diagnostic setting to send data to a Log Analytics workspace, a Storage Account, and an Event Hub simultaneously.
Q: What happens if the connection to the destination is lost? A: Microsoft handles the retry logic. If the destination (like Log Analytics) is temporarily unavailable, the system will buffer the logs and attempt to send them once the connection is restored.
Q: Should I enable "AllLogs" or select specific categories? A: It is better to be selective. While "AllLogs" sounds comprehensive, it can significantly increase ingestion costs. Stick to the categories that provide the most security value unless you have a specific compliance requirement for the others.
Q: Can I use diagnostic settings for B2C tenants? A: Yes. Microsoft Entra ID B2C also supports diagnostic settings, and the configuration process is nearly identical to the standard Entra ID tenant.
Not read yet
Key Takeaways
As we conclude this lesson, keep these core principles in mind to maintain a secure and observable identity environment:
- Retention is a choice: Never rely on the default 30-day retention period. If you don't configure diagnostic settings, you are effectively choosing to lose your historical security data.
- Choose the right destination: Use Log Analytics for analysis and alerting, Storage Accounts for long-term compliance, and Event Hubs for integration with third-party SIEMs.
- Automation is mandatory: Use PowerShell or Infrastructure as Code (like Bicep or Terraform) to manage diagnostic settings across your environment to ensure consistency and prevent manual configuration drift.
- Alert on the important stuff: Logs are only valuable if they lead to action. Configure alerts for high-risk activities, such as changes to privileged roles or suspicious sign-in patterns.
- Monitor the monitor: Ensure you have alerts in place if someone attempts to tamper with your diagnostic settings. Your logging infrastructure is a prime target for attackers trying to cover their tracks.
- Review and refine: Identity environments evolve rapidly. Periodic reviews of your log categories, retention policies, and access controls are essential to keep your security posture aligned with your organizational needs.
- Understand your costs: Always keep an eye on log ingestion volume. Use Azure Cost Management to ensure your logging strategy remains sustainable as your organization grows.
By mastering the configuration of diagnostic settings, you transform Microsoft Entra ID from a black box into a transparent, observable system. This visibility is the foundation of modern identity governance and the most effective way to protect your organization against the rising tide of identity-based threats.
Not read yet
Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.
- Introduction to Microsoft Entra ID
- Introduction to Microsoft Entra ID Quiz5q
- Configure Tenant Settings
- Configure Tenant Settings Quiz5q
- Custom Domain Names
- Custom Domain Names Quiz5q
- Device Identity and Registration
- Device Identity and Registration Quiz5q
- Company Branding Configuration
- Company Branding Configuration Quiz5q
- Create and Manage User Accounts
- Create and Manage User Accounts Quiz5q
- Bulk User Operations
- Bulk User Operations Quiz5q
- Create and Manage Groups
- Create and Manage Groups Quiz5q
- Dynamic Group Membership
- Dynamic Group Membership Quiz5q
- Administrative Units
- Administrative Units Quiz5q
- License Assignment and Management
- License Assignment and Management Quiz5q
- External Collaboration Settings
- External Collaboration Settings Quiz5q
- Invite External Users
- Invite External Users Quiz5q
- B2B Collaboration and Direct Connect
- B2B Collaboration and Direct Connect Quiz5q
- Cross-Tenant Access Settings
- Cross-Tenant Access Settings Quiz5q
- Identity Provider Configuration
- Identity Provider Configuration Quiz5q
- Microsoft Entra Connect Overview
- Microsoft Entra Connect Overview Quiz5q
- Password Hash Synchronization
- Password Hash Synchronization Quiz5q
- Pass-Through Authentication
- Pass-Through Authentication Quiz5q
- Federation with AD FS
- Federation with AD FS Quiz5q
- Entra Connect Cloud Sync
- Entra Connect Cloud Sync Quiz5q
- Authentication Methods Overview
- Authentication Methods Overview Quiz5q
- Passwordless Authentication
- Passwordless Authentication Quiz5q
- Self-Service Password Reset
- Self-Service Password Reset Quiz5q
- Password Protection and Smart Lockout
- Password Protection and Smart Lockout Quiz5q
- FIDO2 Security Keys
- FIDO2 Security Keys Quiz5q
- Microsoft Authenticator App
- Microsoft Authenticator App Quiz5q
- Conditional Access Overview
- Conditional Access Overview Quiz5q
- Create Conditional Access Policies
- Create Conditional Access Policies Quiz5q
- Named Locations and Terms of Use
- Named Locations and Terms of Use Quiz5q
- Session Controls and App Controls
- Session Controls and App Controls Quiz5q
- Authentication Strength Policies
- Authentication Strength Policies Quiz5q
Spend your points to unlock exam-style practice questions
Spend points to unlock SC-300 exam-style practice questions.
Practice for SC-300