AZ-104 Microsoft Azure Administrator Exam

You're a great admin... on-prem. Now, become a great admin in the cloud and prove it by passing the Microsoft Certified: Azure Administrator Associate exam!

Practice Test

Exam

Query and analyze logs in Azure Monitor

Utilize Kusto Query Language (KQL) for Log Analysis

Kusto Query Language (KQL) is a powerful tool used in Azure Monitor to analyze log data. It allows users to query, filter, and visualize log data to diagnose issues, optimize performance, and ensure security compliance.

Key Concepts

KQL operates on schema entities such as tables and columns, similar to SQL. It supports relational operations like project, restrict, join, and summarize, which correspond to SQL's SELECT, JOIN, WHERE, and GROUP BY clauses. This similarity makes it intuitive for users already familiar with SQL syntax. Understanding the basics of KQL is essential to effectively search and manipulate log data in Azure environments.

Basic Queries

To get started with KQL, you can use sample queries. For example, you can display all managed instances with an average CPU utilization over 95%. Here's a basic query snippet using KQL:

let cpu_percentage_threshold = 95;
let time_threshold = ago(1h);
AzureDiagnostics
| where Category == "ResourceUsageStats" and TimeGenerated > time_threshold
| summarize avg_cpu = max(todouble(avg_cpu_percent_s)) by _ResourceId
| where avg_cpu > cpu_percentage_threshold

This query filters log records to identify instances with high CPU usage. Another example shows how to discover instances with storage utilization over 90%, allowing users to proactively manage resources.

Advanced Analysis

KQL includes advanced features like machine learning operators and functions for time series analysis, anomaly detection, forecasting, and root cause analysis. These capabilities enable comprehensive data analysis without needing external tools. By leveraging these advanced functionalities, users can gain insights into performance trends and potential system issues promptly, making data-driven decisions better.

Visualization Tools

Azure Monitor supports visualization through several tools. Dashboards allow you to combine different data types into a single view within the Azure portal. Workbooks provide customizable reports that can include text, metrics, and log queries for detailed analysis. Other tools like Grafana and Power BI offer platforms for creating interactive dashboards and visualizations across various data sources, making it easier to interpret log data.

Exporting Data

Data export from Azure Monitor is facilitated through multiple methods. You can extract metrics using the REST API tailored for metrics or import data from the Azure Monitor metrics database into external tools. Logs can also be exported using relevant APIs or client libraries, ensuring flexibility in data management. Additionally, Workspace Data Export allows exporting data from your Log Analytics workspace for broader analysis.

Alerts

Azure Monitor's alert system is crucial in notifying users when specific conditions are met in monitoring data. This proactive approach helps identify and address issues before they affect end-users or business operations. Alerts can be configured for any metric or log data source in Azure Monitor, offering peace of mind through early warning systems.

In summary, mastering KQL and utilizing Azure Monitor’s tools for log analysis can significantly enhance your ability to diagnose issues, optimize performance, and ensure security compliance in Azure environments. It's about transforming raw logs into actionable insights that support robust cloud infrastructure management.