Azure Monitor Query for Java
Query Azure Monitor logs and resource metrics from Java applications.
The documentation requires a TokenCredential and uses environment variables for workspace, resource, and credential configuration. The examples perform read-oriented queries, with no malicious behavior or destructive defaults observed. However, least-privilege RBAC guidance, sensitive-data handling, data-flow disclosure, user confirmation, auditing, and rollback are absent, so points are deducted.
It covers synchronous and asynchronous clients, logs, metrics, batch queries, and error handling, including failure-status checks. However, the package is explicitly deprecated, examples contain incomplete placeholders and missing imports, and some APIs appear inconsistent. No skill-specific reproducible tests are provided, so the score is limited by static evidence.
The Java audience, trigger phrases, and logs/metrics scenarios are relatively clear, and China-cloud endpoints are included, supporting mainland-China environment fit. Non-fit boundaries are not defined, and the skill targets a deprecated package that should be replaced for new projects, so points are deducted.
The skill has metadata, installation and prerequisite notes, structured sections, reference examples, error handling, MIT licensing, author and version metadata, and an explicit deprecation notice. It lacks a changelog, clear maintenance ownership or update path, and contains hidden assumptions and placeholders; the pinned version may also become stale.
The examples can directly help generate Java code for Azure Monitor Query clients, Kusto, logs, metrics, and batch queries, providing clear marginal value. However, the target package is deprecated, several examples need manual correction, and no executed validation or complete project template is supplied, so only limited credit is justified.
The skill supplies references for the API, repository, migration, package, and troubleshooting material, together with versioned code examples. This review is static only; there are no skill-specific tests, CI coverage, or third-party execution artifacts establishing correctness of the key paths, so the score is limited.
- This skill targets the deprecated azure-monitor-query package; new projects should prefer azure-monitor-query-logs and azure-monitor-query-metrics.
- Examples contain placeholders, missing imports, and apparent result-status/API inconsistencies; compile-check them against the intended SDK version before use.
- Least-privilege RBAC and sensitive-data handling for log queries are not specified; users should restrict credentials and query scope themselves.
- No skill-specific execution or test evidence is supplied, so this review cannot confirm that the examples run.
What it does & when to use it
This skill guides Java developers through the Azure Monitor Query SDK for querying Log Analytics with Kusto Query Language and retrieving metrics from Azure resources. It covers synchronous and asynchronous clients, batch log queries, multiple workspaces, metric aggregations, result mapping, and error handling. The referenced azure-monitor-query package is deprecated; new development should migrate to azure-monitor-query-logs and azure-monitor-query-metrics.
It shows how to add com.azure:azure-monitor-query:1.5.9 with Maven and create LogsQueryClient, LogsQueryAsyncClient, MetricsQueryClient, and MetricsQueryAsyncClient instances with TokenCredential. It runs workspace- or resource-scoped Kusto log queries, reads table rows, statistics, visualization data, and partial-failure states, and queries Azure resource metrics including time series, dimensions, and aggregate values. It also demonstrates batch queries, multiple workspaces and resources, timeouts, sovereign-cloud endpoints, custom model mapping, and exception handling.
- A Java Azure developer needs to run Kusto queries against a Log Analytics workspace and read activity-log results.
- A monitoring engineer needs Azure resource metric time series with dimensions, averages, totals, or counts.
- A team needs to submit several Log Analytics queries in one batch and inspect each result independently.
- A Java developer needs to map returned log rows into a custom application model.
- An application targeting Azure China Cloud needs example log and metric endpoint configuration.
Pros & cons
- Covers both Azure Monitor logs and metrics queries.
- Includes synchronous and asynchronous client examples.
- Demonstrates batch queries, multiple workspaces, aggregations, statistics, visualization, and failure handling.
- Provides Maven, DefaultAzureCredential, and sovereign-cloud configuration examples.
- The referenced `azure-monitor-query` package is deprecated, so new projects should migrate to two successor packages.
- Users need a Log Analytics workspace or Azure resource and a properly authorized TokenCredential.
- The source provides no independent test result or compatibility record for this specific skill.
- The scope is limited to the Java Azure Monitor Query SDK, not other Azure services or languages.
How to install
Install the skill through the collection command npx skills add microsoft/skills, then select the required skill in the wizard. The README uses .github/skills/ as an example destination for GitHub Copilot. In the Java project, add Maven dependency com.azure:azure-monitor-query:1.5.9, or manage its version through the Azure SDK BOM.
How to use
Trigger the skill with phrases such as LogsQueryClient java, MetricsQueryClient java, kusto query java, log analytics java, or azure monitor query java. Provide a Log Analytics workspace or Azure resource and a TokenCredential with appropriate permissions; configure LOG_ANALYTICS_WORKSPACE_ID, AZURE_RESOURCE_ID, and, when using DefaultAzureCredential in production, AZURE_TOKEN_CREDENTIALS as needed. Because the package is deprecated, use the skill's migration guidance for new implementations.
Compared to similar skills
The source explicitly identifies azure-monitor-query-logs for Log Analytics queries and azure-monitor-query-metrics for metrics queries as the migration alternatives.