Resource Groups

Filters

  • Standard Value Filter (see Generic Filters)
  • ARM Resource Filters (see Generic Filters)
    • Tag Filter - Filter on tag presence and/or values
    • Marked-For-Op Filter - Filter on tag that indicates a scheduled operation for a resource
  • empty-group Filter based on empty resource groups

    Schema:

    "Schema in unexpected format."
    

Actions

  • ARM Resource Actions (see Generic Actions)

  • delete Delete a resource group

    Schema:

    {}
    

Example Policies

This policy will delete all empty resource groups

policies:
  - name: delete-empty-groups
    resource: azure.resourcegroup
    filters:
     - type: empty-group
    actions:
     - type: delete

This set of policies will mark all resource groups for deletion in 7 days that have ‘test’ in name (ignore case), and then perform the delete operation on those ready for deletion.

policies:
  - name: mark-test-groups-for-deletion
    resource: azure.resourcegroup
    filters:
      - type: value
        key: name
        op: in
        value_type: normalize
        value: test
     actions:
      - type: mark-for-op
        op: delete
        days: 7
  - name: delete-test-resource-groups
    resource: azure.resourcegroup
    filters:
      - type: marked-for-op
        op: delete
    actions:
      - type: delete