Read the activity log: who did what, and when
In this task you'll see who created, changed or deleted a resource.
The activity log records every change made to your Azure resources: who created, changed or deleted what, when, and whether it worked. It covers the management of resources, not what happens inside them (such as files read from storage).
Azure keeps the activity log for 90 days. To keep it longer or search it with queries, send it to a Log Analytics workspace (task 3 of this section).
Example. On Monday morning, a test database at Larkfield Group has vanished. The activity log shows it was deleted on Friday at 17:42 by a cleanup script running under an automation account, which pointed the team straight at the bug.
Before you start
You need: Reader on the subscription or resource group. Time: 10 minutes.
Where to look
- Home
- Monitor
- Activity log
Steps
- Search for monitor and open Monitor, then select Activity log.
- Change Timespan (it starts at Last 6 hours) to the last week. You'll see the resources you've created and deleted while working through this guide.On a brand new free account, the first event is the creation of your subscription.
- Select Add Filter and filter by Resource group (choose rg-portal-practice) or by operation, such as Delete resource group.
- Select an event to see its summary, then the JSON tab for every detail, including the caller.
- Open any resource group and select Activity log in its menu to see the same events, filtered to that group.
Tip. Every resource and resource group also has its own Activity log page, already filtered to it.
Commands
# Last week's changes to the practice group: when, what and who
az monitor activity-log list --resource-group rg-portal-practice --offset 7d \
--query "[].{time:eventTimestamp, operation:operationName.localizedValue, caller:caller, status:status.value}" \
--output table
Watch out for
- Cost
- Viewing the activity log is free, and so is sending it to a Log Analytics workspace (searching it there is billed like other logs).
- Security
- The activity log is your first stop after something unexpected changes. Anyone with Reader can see it, including the names of people who made changes.
- Common mistakes
- Looking for data access, such as who downloaded a file: that's in the resource's own diagnostic logs, not the activity log. Searching beyond 90 days without having exported the log.
Clean up
Nothing to clean up. This task only reads.
Words to know
- Activity log
- The record of management actions on your Azure resources.
- Caller
- The user, app or service that made the change.
- Operation
- What was done, such as Delete resource group or Create role assignment.
Tick off each step and track your progress in the guide.
Open this task in Azure Portal, Hands On