An administrator needs to write a KQL query in Log Analytics to identify all failed secret retrieval operations (SecretGet) in an Azure Key Vault. The query must find operations that failed due to unauthorized access (status codes 401 or 403) within the last 7 days.
Which two of the following KQL queries will return the correct results? (Select TWO)
- AzureDiagnostics
| where TimeGenerated > ago(7d)
| where ResourceProvider == "MICROSOFT.KEYVAULT" and OperationName == "SecretGet"
| where ResultSignature in ("401", "403")Cevap - AzureDiagnostics
| where ResourceProvider == "MICROSOFT.KEYVAULT"
| where OperationName == "SecretGet"
| where ResultSignature == "401" or ResultSignature == "403"
| where TimeGenerated >= ago(7d)Cevap - CAzureDiagnostics
| where TimeGenerated > ago(7d)
| where ResourceProvider = "MICROSOFT.KEYVAULT"
| where OperationName = "SecretGet"
| where ResultSignature == 401 or 403 - DAzureDiagnostics
| where TimeGenerated > ago(7d)
| select ResourceProvider, OperationName, ResultSignature
| where ResourceProvider == "MICROSOFT.KEYVAULT"
| where OperationName == "SecretGet"
| where ResultSignature in ("401", "403")
Cevap
The correct queries are the ones that use the double equals operator (`==`) for equality comparison, filter using the string values `"401"` and `"403"`, and do not use the SQL-style `select` keyword.
The correct queries use valid Kusto Query Language (KQL) syntax to filter the Log Analytics workspace. Specifically, they utilize the double equals operator (`==`) for equality comparison, filter the time range properly with the `ago` function, and query `ResultSignature` against string values (since diagnostic status codes in `AzureDiagnostics` are stored as strings). The order of the `where` clauses does not affect the correctness of the KQL query, so both variations are valid.
Adım Adım Çözüm
Anahtar Kavram
Writing valid KQL queries in Azure Log Analytics to filter diagnostic logs using proper comparison operators, string matching, and standard KQL syntax.
Tahmini Süre:1m 30s