Skip to content

Commit 4ffe962

Browse files
authored
Merge pull request #202660 from iancarter-msft/patch-1
Update get-resource-changes.md
2 parents 8cc5d04 + 516c442 commit 4ffe962

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

articles/governance/resource-graph/how-to/get-resource-changes.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Monitor.
4040
> [Guest Configuration for VMs](../../policy/concepts/guest-configuration.md). To view examples of how to query Guest Configuration resources in Resource Graph, view [Azure Resource Graph queries by category - Azure Policy Guest Configuration](../samples/samples-by-category.md#azure-policy-guest-configuration).
4141
4242
> [!IMPORTANT]
43-
> Resource configuration changes only supports changes to resource types from the [Resources table](..//reference/supported-tables-resources.md#resources) in Resource Graph. This does not yet include changes to the resource container resources, such as Subscriptions and Resource groups. Changes are queryable for fourteen days. For longer retention, you can [integrate your Resource Graph query with Azure Logic Apps](../tutorials/logic-app-calling-arg.md) and export your query results to any of the Azure data stores (e.g., Log Analytics) for your desired retention.
43+
> Resource configuration changes only supports changes to resource types from the [Resources table](..//reference/supported-tables-resources.md#resources) in Resource Graph. This does not yet include changes to the resource container resources, such as Subscriptions and Resource groups. Changes are queryable for fourteen days. For longer retention, you can [integrate your Resource Graph query with Azure Logic Apps](../tutorials/logic-app-calling-arg.md) and export query result to any of the Azure data stores (e.g., Log Analytics) for your desired retention.
4444
4545
## Find detected change events and view change details
4646

@@ -274,6 +274,38 @@ resourcechanges
274274
| project changeTime, changeType, id, resourceGroup, type, properties
275275
```
276276

277+
### Changes in virtual machine size 
278+
```kusto
279+
resourcechanges
280+
|extend vmSize = properties.changes["properties.hardwareProfile.vmSize"], changeTime = todatetime(properties.changeAttributes.timestamp), targetResourceId = tostring(properties.targetResourceId), changeType = tostring(properties.changeType) 
281+
| where isnotempty(vmSize) 
282+
| order by changeTime desc 
283+
| project changeTime, targetResourceId, changeType, properties.changes, previousSize = vmSize.previousValue, newSize = vmSize.newValue
284+
```
285+
286+
### Count of changes by change type and subscription name
287+
```kusto
288+
resourcechanges  
289+
|extend changeType = tostring(properties.changeType), changeTime = todatetime(properties.changeAttributes.timestamp), targetResourceType=tostring(properties.targetResourceType)  
290+
| summarize count() by changeType, subscriptionId 
291+
| join (resourcecontainers | where type=='microsoft.resources/subscriptions' | project SubscriptionName=name, subscriptionId) on subscriptionId 
292+
| project-away subscriptionId, subscriptionId1
293+
| order by count_ desc  
294+
```
295+
296+
297+
### Query the latest resource configuration for resources created with a certain tag
298+
```kusto
299+
resourcechanges 
300+
|extend targetResourceId = tostring(properties.targetResourceId), changeType = tostring(properties.changeType), createTime = todatetime(properties.changeAttributes.timestamp) 
301+
| where createTime > ago(7d) and changeType == "Create" 
302+
| project  targetResourceId, changeType, createTime 
303+
| join ( resources | extend targetResourceId=id) on targetResourceId 
304+
| where tags[“Environment”] =~ “prod” 
305+
| order by createTime desc 
306+
| project createTime, id, resourceGroup, type
307+
```
308+
277309
## Next steps
278310

279311
- See the language in use in [Starter queries](../samples/starter.md).

0 commit comments

Comments
 (0)