Configure Diagnostic Settings

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② 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

  1. Sign in to the Microsoft Entra admin center.
  2. Navigate to Identity > Monitoring & health > Diagnostic settings.
  3. Click + Add diagnostic setting.

Step 3: Configure the Settings

  1. Name: Give your setting a descriptive name (e.g., "EntraID-to-LogAnalytics").
  2. Categories: Select the logs you want to stream. It is standard practice to select AuditLogs, SignInLogs, NonInteractiveUserSignInLogs, ServicePrincipalSignInLogs, and ManagedIdentitySignInLogs.
  3. Destination details: Check the box for "Send to Log Analytics workspace." Select your subscription and the workspace you created in Step 1.
  4. 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 workspaceId to point to the specific Log Analytics instance.
  • The ResourceId must 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:

  • AuditLogs and SigninLogs are the tables where your data lives.
  • summarize is 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:

  1. Diagnostic Settings: Send logs to an Azure Event Hub.
  2. Event Hub: Acts as a buffer to hold the logs.
  3. 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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.