What Does Diagnostic setting Mean?
On This Page
Quick Definition
A Diagnostic setting tells Azure where to send detailed information about how your resources are performing. You can choose to send this data to a storage account for long-term keeping, a Log Analytics workspace for searching and analyzing, or an event hub for real-time processing. It helps you see what is happening inside your virtual machines, databases, and other services.
Commonly Confused With
The Activity Log records all control-plane events for Azure resources, such as creating or deleting a virtual machine. A Diagnostic setting, on the other hand, captures resource-level operational data like CPU usage and database queries. The Activity Log is enabled by default and cannot be disabled, while a Diagnostic setting must be explicitly configured for each resource.
If a user deletes a storage account, that appears in the Activity Log. If the storage account has a Diagnostic setting, you can also see every request that was made to it.
The Azure Monitor Agent is a software component installed inside a virtual machine that collects guest OS logs and performance data. A Diagnostic setting is a configuration resource that routes platform data from the Azure infrastructure. They work together: you use the agent for OS data, and a Diagnostic setting for platform data.
You install the Azure Monitor Agent on a VM to get memory usage from inside the OS. Separately, you create a Diagnostic setting to get the VM's host-level CPU metric.
A Log Analytics workspace is a storage and query environment for log data. A Diagnostic setting is the configuration that sends data to a Log Analytics workspace. The workspace is the destination, while the Diagnostic setting is the rule that defines what data to send.
Think of the Log Analytics workspace as a filing cabinet, and the Diagnostic setting as the set of instructions about which documents to put in the cabinet and how often.
Must Know for Exams
For the AZ-104 Microsoft Azure Administrator exam, Diagnostic settings are a core objective under the 'Monitor and maintain Azure resources' domain. The exam guide explicitly includes 'Configure diagnostic settings for Azure resources' as a skill measured. You will encounter questions that test your ability to choose the correct destination for specific scenarios, understand the default log collection behavior, and recognize the differences between platform logs, activity logs, and resource logs.
Exam questions often present a scenario where an administrator needs to meet a specific business requirement using Diagnostic settings. For example, a company might need to send database audit logs to a third-party SIEM for real-time analysis, while also archiving all virtual machine metrics for seven years to meet compliance. The correct answer would be to create one Diagnostic setting sending logs to an Event Hub for the SIEM, and a separate Diagnostic setting for the storage account with a retention policy of seven years. The exam tests whether you know you can have multiple Diagnostic settings on the same resource, each with different destinations and categories.
Another common question type involves troubleshooting. A user reports that resource logs are not appearing in the Log Analytics workspace they configured. The exam will test your ability to identify the likely causes: the Diagnostic setting might not have been created, the log category might not be selected, the workspace might be in a different region, or the resource might not support that log category. Understanding that you must also have the Azure Monitor Agent installed for guest OS logs is a frequent trap.
The exam also tests your knowledge of cost implications. You might be asked to recommend a configuration that minimizes costs while still meeting monitoring requirements. The correct answer often involves sending verbose logs to a storage account with low-cost access tiers and only sending error-level logs to Log Analytics. The exam wants you to balance functional needs with Azure cost management.
Azure CLI and PowerShell commands for Diagnostic settings are fair game. You should be comfortable with commands like `az monitor diagnostic-settings create` and the equivalent PowerShell cmdlet `New-AzDiagnosticSetting`. Exam questions may ask you to identify the correct parameter to specify the target workspace or storage account. Knowing the syntax and required parameters is essential.
Finally, expect scenario-based questions where you must choose the correct order of operations. For instance, you cannot send logs to a Log Analytics workspace that does not exist yet. The exam may list a series of steps, some out of order, and ask you to select the correct sequence. Understanding that you first create the destination resource, then create the Diagnostic setting, is fundamental.
Simple Meaning
Think of a Diagnostic setting like setting up recording rules for a security camera system in a large building. The camera itself is your Azure resource, like a virtual machine or a database. Without any recording rules, the camera just captures video for a moment but never saves it. You would never know if someone entered a restricted area after hours or if a machine in the server room started overheating.
With a Diagnostic setting, you get to tell the system exactly what to record and where to keep those recordings. You can choose to save the video footage on a local hard drive, which is like sending logs to a storage account. You can also send a live feed to a security guard’s monitor, which is like sending logs to a Log Analytics workspace where you can search and analyze them. Finally, you can send an alert to a central monitoring station, which is like streaming logs to an event hub for real-time processing.
Each recording can include different types of information. For example, you might want to record every time a door opens, or every time the temperature in a room changes. In Azure, these are specific categories of logs and metrics. You can choose to send all categories to one destination, or send only certain categories to different places. This flexibility means you can store historical data cheaply in a storage account while also sending critical performance metrics to a monitoring tool for immediate action.
The key point is that by default, most Azure resources do not collect and save logs automatically. You must create a Diagnostic setting to turn on this collection. Without it, if something goes wrong, you will have no recorded history to investigate. That is like having security cameras that are not plugged into any recording device. Once you configure the Diagnostic setting, the data flows continuously, and you can troubleshoot problems, track usage trends, and ensure your applications are healthy.
Full Technical Definition
A Diagnostic setting in Microsoft Azure is a configuration resource that defines the collection and routing of platform logs and metrics for a given Azure resource. Platform logs are detailed diagnostic and audit information generated by the Azure infrastructure for each resource, such as activity logs, resource logs, and metrics. Resource logs, previously called diagnostic logs, contain information about the internal operations of a resource, for example, the read and write operations on a storage account or the requests processed by an application gateway.
When you create a Diagnostic setting, you specify one or more destination endpoints for the log data. The three supported destinations are an Azure Storage account, an Azure Log Analytics workspace, and an Azure Event Hub. Each destination serves a different purpose. A storage account is ideal for long-term archival, compliance, and audit scenarios because it provides durable, low-cost object storage. A Log Analytics workspace enables advanced querying with Kusto Query Language (KQL), alerts, and integration with Azure Monitor workbooks and dashboards. An Event Hub allows real-time streaming of log data to third-party security information and event management (SIEM) systems, such as Splunk or QRadar, or to custom processing pipelines.
For each destination, you must select one or more log categories and metrics. Log categories are specific to each resource type. For example, for a virtual machine, categories include VMHealth, GuestOS, and Heartbeat. For Azure SQL Database, categories include SQLInsights, AutomaticTuning, and QueryStoreRuntimeStatistics. Metrics are numerical values collected at regular intervals, such as CPU percentage, disk I/O, and network throughput. You can choose to send all categories or only a subset. You can also send the same category to multiple destinations if needed, though this will increase data egress costs.
The Diagnostic setting is implemented at the resource level. When you enable it, the Azure resource emits telemetry data according to the categories selected. The Azure Monitor service then processes this telemetry and routes it to the configured destinations. The data is formatted in a standardized schema that includes common fields like resourceId, operationName, category, and level. This schema ensures consistency across different resource types and enables cross-resource queries in Log Analytics.
a Diagnostic setting does not collect guest-level operating system logs unless you install the Azure Monitor Agent on the virtual machine. For guest OS logs, you need the Azure Diagnostics extension or the Log Analytics agent. The Diagnostic setting only captures platform-level logs and metrics. Also, enabling a Diagnostic setting incurs additional costs based on the volume of data ingested, the storage consumed, and the number of Event Hub throughput units. Therefore, you should carefully select only the categories you need to minimize cost.
From an exam perspective for AZ-104, candidates must understand how to create and manage Diagnostic settings using the Azure portal, PowerShell, Azure CLI, and Azure Resource Manager (ARM) templates. The exam also tests the ability to differentiate between the three destination types and to troubleshoot common issues, such as logs not appearing in the expected destination due to misconfigured retention policies, network restrictions, or missing permissions.
Real-Life Example
Imagine you are the building manager for a large apartment complex with dozens of units. Each apartment has its own smart thermostat, water heater, and security camera. By default, none of these devices record any data. They simply work in the moment. If a tenant reports that their water heater broke last night, you have no way to know what the temperature was or when the failure occurred. That is exactly like having Azure resources without a Diagnostic setting.
Now suppose you decide to set up a central logging system for the entire building. You install a central control panel in your office. For each thermostat, water heater, and camera, you configure a Diagnostic setting. You tell the thermostat to send its temperature reading every ten minutes to a cloud data bucket, which is like an Azure Storage account. You tell the water heater to send error codes and power usage to a central analysis dashboard, which is like a Log Analytics workspace. You also configure the security camera to stream motion detection events to a live monitoring service, which is like an Event Hub that feeds into a security company’s system.
Each device has different categories of data it can share. The thermostat can report temperature, humidity, and fan status. The water heater can report water temperature, power consumption, and error codes. With a Diagnostic setting, you can decide exactly which categories to send to each destination. You might not care about humidity from the thermostat, so you only send temperature. The water heater’s error codes are critical, so you send those to both the dashboard and the storage bucket for legal records.
This arrangement works perfectly until one day the security camera stops sending motion events. You check the camera, and it is working, but the data is not reaching the monitoring service. You need to investigate the Diagnostic setting. Perhaps the camera’s category for motion events changed after a firmware update, or the connection to the Event Hub was blocked by a network firewall. In IT terms, that is exactly the kind of troubleshooting you do when logs stop flowing. The Diagnostic setting is the configuration that makes the whole data pipeline possible, and without it, you are blind to what your devices are doing.
Why This Term Matters
Diagnostic settings are the foundation of observability and monitoring in Azure. Without them, Azure resources operate in a cloud with no recorded history, making it impossible to troubleshoot failures, detect security incidents, or optimize performance. In a production environment, you cannot afford to be blind to what your systems are doing. A single misconfigured Diagnostic setting can mean the difference between identifying a root cause in minutes versus spending hours manually recreating an issue.
For IT professionals, understanding Diagnostic settings is crucial because they directly impact operational efficiency. When a virtual machine becomes unresponsive, the first step is to check platform logs to see if there were any resource-level events, such as a host server failure or a disk error. Without a Diagnostic setting sending those logs to a Log Analytics workspace, you have no historical data to query. You would be limited to current metrics and the Azure Activity Log, which only shows management events, not internal resource operations.
Cost management is another critical reason why Diagnostic settings matter. Ingesting and storing log data is not free. If you send every possible log category to a Log Analytics workspace, your monthly costs can spike dramatically. By carefully selecting only the categories you need and choosing the appropriate destination, you can control costs while still having the data you require. For example, you might send debug logs to a storage account for cheap archival and only send error logs to Log Analytics for real-time alerting.
Compliance and audit requirements often mandate that certain logs be retained for years. Diagnostic settings to a storage account with a configured retention policy meet this need. For auditors who ask for proof that a specific action occurred on a specific date, you can point to the stored logs. Without this capability, you risk failing compliance audits and facing regulatory penalties.
Finally, Diagnostic settings are a frequent topic in Azure certification exams like AZ-104. The exam expects you to know how to configure them, what destinations are available, and how to troubleshoot when logs are missing. Mastery of this topic demonstrates that you can build a robust monitoring foundation for any Azure workload.
How It Appears in Exam Questions
Diagnostic setting questions on the AZ-104 exam appear in multiple-choice, multiple-select, and drag-and-drop formats. The most common pattern is a scenario-based question that describes a business requirement and asks you to select the correct configuration from a list of options. For example, 'You need to ensure that all platform logs from an Azure SQL database are sent to a Log Analytics workspace for querying. You must archive the logs for five years. What should you do?' The correct answer is to create a Diagnostic setting with both the Log Analytics workspace and a storage account as destinations, and configure the retention policy on the storage account.
Another frequent pattern is the 'troubleshooting' question. The question describes a situation where logs are not arriving at the intended destination. Possible answer choices will include reasons such as 'The Diagnostic setting was not created', 'The resource does not support the selected log category', or 'The Log Analytics workspace is in a different Azure region'. You need to know that cross-region routing is allowed, so region mismatch is generally not a problem. The real issue is more likely that the category does not exist for that resource type, or the setting was accidentally deleted.
Drag-and-drop questions require you to match log destinations to their primary use case. You might see three columns: 'Storage Account', 'Log Analytics Workspace', and 'Event Hub'. The items to drag are 'Long-term archival', 'Real-time SIEM integration', and 'Advanced KQL queries'. The correct arrangement maps Storage Account to archival, Event Hub to SIEM, and Log Analytics to KQL queries.
Questions also test your knowledge of retention policies. For example, 'You configure a Diagnostic setting to send logs to a storage account. You want to automatically delete logs older than 30 days. What should you do?' The answer is to set a retention policy on the storage account container where the logs are stored, not on the Diagnostic setting itself. The Diagnostic setting does not have a retention property for storage, retention is managed at the storage level.
Finally, exam questions may combine Diagnostic settings with Azure Policy. You might be asked to recommend a method to enforce that all virtual machines in a subscription have a Diagnostic setting enabled. The correct answer is to create an Azure Policy that audits or deploys Diagnostic settings. This shows how Diagnostic settings integrate with broader governance strategies.
Practise Diagnostic setting Questions
Test your understanding with exam-style practice questions.
Example Scenario
Contoso, a retail company, runs an e-commerce application on an Azure virtual machine. The application experiences occasional slowdowns that last for about 15 minutes. The IT team suspects it is a periodic CPU spike, but they have no historical data to confirm. The virtual machine is already deployed, but no Diagnostic setting has been configured yet.
Sarah, the Azure administrator, decides to set up monitoring. She navigates to the virtual machine in the Azure portal and opens the 'Diagnostic settings' blade. She clicks 'Add diagnostic setting' and names it 'VM-Monitoring'. She selects the metric 'Percentage CPU' and the log categories 'VMHealth' and 'Heartbeat'. For the destination, she chooses 'Send to Log Analytics workspace' and selects an existing workspace named 'ContosoWorkspace'. She also checks 'Archive to a storage account' and selects 'ContosoLogs' storage account with a retention policy of 90 days.
After saving the setting, the logs and metrics begin flowing immediately. The next time the application slows down, Sarah opens Azure Monitor and writes a KQL query: 'VMComputer | where TimeGenerated > ago(1h) | summarize avg(CPU) by bin(TimeGenerated, 1m)'. The query returns a clear spike in CPU usage that matches the exact time of the slowdown. She now knows the root cause is a CPU-intensive background process on the virtual machine.
Sarah then sets up an alert rule based on the metric data from the Diagnostic setting. If CPU usage exceeds 80% for more than 5 minutes, the operations team gets an email. Without the Diagnostic setting, she would have had no data to query and no way to create the alert. This scenario shows how a simple configuration change can transform a reactive troubleshooting culture into a proactive monitoring practice.
Common Mistakes
Thinking that enabling the Diagnostics setting automatically collects guest OS logs from a virtual machine.
The Diagnostic setting only collects platform logs and metrics from the Azure infrastructure, not from inside the guest operating system. Guest OS logs require the Azure Monitor Agent or the Azure Diagnostics extension to be installed on the VM.
Install the Azure Monitor Agent on the virtual machine and configure it to send guest OS logs to the same Log Analytics workspace.
Believing that you can only have one Diagnostic setting per resource.
You can create up to five Diagnostic settings on the same Azure resource, each with different combinations of destinations and log categories. This allows you to simultaneously send logs to a storage account for archival and to a Log Analytics workspace for analysis.
Create multiple Diagnostic settings on the same resource if you need to send different log categories to different destinations.
Assuming that all Azure resources support the same log categories.
Each Azure resource type has its own set of available log categories. A Diagnostic setting for an Azure SQL Database will have different categories than one for a storage account. Selecting a category that does not exist for that resource will result in no data being collected.
Check the official Azure documentation for the exact list of log categories supported by the specific resource type before creating the setting.
Not configuring a retention policy on a storage account and expecting logs to be deleted automatically.
The Diagnostic setting itself does not manage retention for the storage account destination. If you do not set a retention policy on the container or the storage account, logs will accumulate indefinitely, leading to high storage costs.
Set a retention policy directly on the storage account container or at the storage account level, specifying how many days to keep the log files.
Exam Trap — Don't Get Fooled
{"trap":"A question states that you need to collect operating system logs from a virtual machine. The answer choice suggests creating a Diagnostic setting and sending the 'Guest OS' category to a Log Analytics workspace. Many learners choose this because it sounds like the correct category."
,"why_learners_choose_it":"Learners see 'Guest OS' in the category list when creating a Diagnostic setting and assume that it collects guest-level logs. They do not realize that this category is only for platform-level guest metrics and requires an agent for full OS log collection.","how_to_avoid_it":"Remember that the Diagnostic setting alone cannot capture guest OS logs.
You always need an agent inside the VM. The correct answer in the exam will specify installing the Azure Monitor Agent and configuring it to send to the Log Analytics workspace. A Diagnostic setting is still needed for platform-level metrics, but not for OS logs."
Step-by-Step Breakdown
Identify the resource
Choose the Azure resource you want to monitor, such as a virtual machine, Azure SQL database, or storage account. The Diagnostic setting is created at the resource level, so you must navigate to that specific resource's blade in the portal.
Select the destination
Decide where to send the log data. The three options are a Log Analytics workspace for querying, a storage account for archival, or an Event Hub for streaming. You can select multiple destinations for the same setting.
Choose log categories and metrics
From the available list, check the categories and metrics you want to collect. Each resource type has its own unique set. Select only what you need to control costs. For example, for a virtual machine, you might select 'VMHealth' and 'Percentage CPU'.
Configure retention (if applicable)
For storage account destinations, you can set a retention policy in days. Logs older than this will be automatically deleted. This is not set in the Diagnostic setting itself but on the storage account container or account.
Save and verify
Click 'Save' to create the Diagnostic setting. After a few minutes, check the destination to verify data is flowing. You can run a simple query in Log Analytics or browse the storage container to see the log files.
Practical Mini-Lesson
Diagnostic settings are one of the most frequently used monitoring features in Azure, yet they are often misunderstood by newcomers. The core idea is simple: you tell Azure what data to collect and where to put it. However, the practical implementation has several nuances that professionals must understand to avoid costly mistakes.
First, know that a single resource can have up to five Diagnostic settings. This is extremely useful when you need to send different subsets of logs to different teams or systems. For instance, you might send security-related logs to an Event Hub for the security operations center, and send performance metrics to a Log Analytics workspace for the development team. Both settings can exist on the same virtual machine.
Second, always double-check which log categories are available for the specific resource you are configuring. Not all categories are available for all resource types. For example, a storage account has categories like 'StorageRead', 'StorageWrite', and 'StorageDelete', while an Azure SQL database has categories like 'SQLInsights' and 'QueryStoreRuntimeStatistics'. If you select a category that does not exist for that resource, the setting saves but no data flows for that category.
Third, be aware of the cost implications. Sending all categories to a Log Analytics workspace can quickly become expensive, especially for high-traffic resources like application gateways or load balancers. A common best practice is to send verbose logs to a storage account with a low-cost access tier and only send critical error logs to Log Analytics. You can achieve this by creating one Diagnostic setting for storage that includes all categories, and another Diagnostic setting for Log Analytics that only includes error-level categories.
What can go wrong? The most common issue is that logs stop flowing unexpectedly. This can happen if the destination resource is deleted or moved to another subscription. If a Log Analytics workspace is deleted, the Diagnostic setting still exists but data cannot be delivered. You will see an error in the Azure Monitor diagnostics logs. Another issue is network security: if you use a storage account with a firewall enabled, you must allow the Azure Monitor service to access it. Otherwise, the logs will be dropped.
Finally, remember that Diagnostic settings do not support custom log schemas. The data is always in a predefined schema that includes fields like 'resourceId', 'category', 'operationName', and 'timeGenerated'. If you need to send custom logs, you must use the Azure Monitor Agent or a custom application using the Azure Monitor Data Collection API. For exam and real-world purposes, mastering Diagnostic settings is a foundational skill that enables all higher-level monitoring and alerting scenarios.
Memory Tip
Think 'DAD', Destination, Action, Data. First, choose the Destination (workspace, storage, hub). Then set the Action (which categories). Finally, verify the Data is flowing.
Covered in These Exams
Current Exam Context
Current exam versions that test this topic — use these objectives when studying.
Related Glossary Terms
Two-factor authentication (2FA) is a security method that requires two different types of proof before granting access to an account or system.
AAA (Authentication, Authorization, and Accounting) is a security framework that controls who can access a network, what they are allowed to do, and tracks what they did.
Frequently Asked Questions
Does a Diagnostic setting collect logs automatically?
No, you must explicitly create a Diagnostic setting for each resource. By default, Azure resources do not send logs to any destination.
Can I send the same log to both a storage account and a Log Analytics workspace?
Yes, you can select multiple destinations in a single Diagnostic setting. The same log data will be sent to all selected destinations.
How many Diagnostic settings can I have on one resource?
You can create up to five Diagnostic settings per resource. This allows different log categories to go to different destinations.
What happens if I delete the Log Analytics workspace that a Diagnostic setting uses?
The Diagnostic setting will stop delivering logs to that workspace. You will see an error, and data will be lost unless you update the setting to use a different workspace.
Do I need a Diagnostic setting for every single Azure resource?
It is a best practice for resources you need to monitor, but it is not mandatory. You only need it if you want to collect platform logs and metrics beyond the default Activity Log.
Can I use a Diagnostic setting to send logs to a storage account in a different subscription?
Yes, but both the resource and the storage account must be in the same Azure Active Directory tenant. Cross-subscription routing is supported within the same tenant.
Summary
A Diagnostic setting is an essential configuration in Azure that enables the collection and routing of platform logs and metrics from Azure resources to destinations like Log Analytics workspaces, storage accounts, or Event Hubs. Without it, you lose visibility into the operational health and performance of your cloud infrastructure. The concept is deceptively simple, but the practical implementation requires attention to detail: selecting the correct log categories, understanding the limitations of guest OS log collection, managing costs through selective data routing, and ensuring retention policies are correctly configured.
For IT certification exams like AZ-104, Diagnostic settings are a high-frequency topic that appears in scenario-based questions, troubleshooting scenarios, and drag-and-drop matching exercises. Mastering this topic demonstrates a solid foundation in Azure monitoring and directly supports skills in alerting, querying, and compliance. The exam expects you to differentiate between platform logs and guest OS logs, know the three destination types, and understand how to create settings using both the portal and command-line tools.
In real-world practice, Diagnostic settings are the first step in building a production-grade observability pipeline. They empower administrators to detect issues early, respond to incidents faster, and meet audit and compliance requirements. By treating Diagnostic settings as a deliberate, cost-conscious configuration rather than a default checkbox, IT professionals can build a robust monitoring foundation that scales with their Azure environments.