An administrator needs to analyze subscription activity logs in a Log Analytics workspace. The administrator must identify all successful deletions of Azure resource locks that occurred within the last 14 days.
Which of the following KQL queries will return the correct results? (Select two.)
- AzureActivity
| where TimeGenerated > ago(14d)
| where OperationNameValue =~ "Microsoft.Authorization/locks/delete"
| where ActivityStatusValue =~ "Success"Answer - BAzureActivity
| where TimeGenerated > 14d
| where OperationNameValue == "Microsoft.Authorization/locks/delete"
| where ActivityStatusValue == "Success" - AzureActivity
| where TimeGenerated >= ago(14d)
| where OperationNameValue contains "locks/delete" and ActivityStatusValue == "Success"Answer - DAzureActivity
| where TimeGenerated > ago(14d)
| select OperationNameValue, ActivityStatusValue, Caller
| where OperationNameValue == "Microsoft.Authorization/locks/delete" and ActivityStatusValue == "Success"
Answer
The KQL queries that correctly retrieve the successful deletions of resource locks in the last 14 days are the query using the ago(14d) function with case-insensitive operators (=~) and the query using the contains operator with a logical 'and' clause.
The correct queries successfully filter the logs using valid KQL syntax. The query that utilizes the =~ operator ensures case-insensitive matching for both the operation name and the success status, while referencing ago(14d) to limit the results to the last 14 days. The other correct query utilizes the contains operator to search for the substring 'locks/delete' and combines the conditions on a single line using the 'and' logical operator, which is functionally equivalent and syntactically valid.
Step-by-Step Solution
Key Concept
Writing KQL queries to retrieve activity log events from a Log Analytics workspace using proper time, string comparison, and projection filters.