Resource Groups - Delete or report on orphan resources (NICs, Disks, Public IPs)ΒΆ

  • Deletes all disks that are not being managed by a VM

policies:
  - name: orphaned-disk
    resource: azure.disk
    filters:
      - type: value
        key: managedBy
        value: null
    actions:
      - type: delete
  • Gets all Network Interfaces that are not attached to any VM

policies:
  - name: orphaned-nic
    resource: azure.networkinterface
    filters:
      - type: value
        key: properties.virtualMachine
        value: null
  • Queues an email with Public IPs that are not attached to any Network Interfaces. See c7n_mailer readme.md for more information on how to send an email.

policies:
  - name: orphaned-ip
    resource: azure.publicip
    filters:
      - type: value
        key: properties.ipConfiguration
        value: null
    actions:
      - type: notify
        template: default
        subject: Orphaned Public IP resource
        to:
          - someone@somewhere.com
        transport:
          type: asq
          queue: https://storagename.queue.core.windows.net/queuename