azure.cost-management-export

Cost Management Exports for current subscription (doesn’t include Resource Group scopes)

example:

Returns all cost exports for current subscription scope

policies:
  - name: get-cost-management-exports
    resource: azure.cost-management-export

Filters

advisor-recommendation

Filter resources by Azure Advisor Recommendations

Select all categories with ‘all’

example:

policies:
  - name: disks-with-cost-recommendations
    resource: azure.disk
    filters:
      - type: advisor-recommendation
        category: Cost
        key: '[].properties.recommendationTypeId'
        op: contains
        value: '48eda464-1485-4dcf-a674-d0905df5054a'
properties:
  category:
    type: string
  default:
    type: object
  key:
    type: string
  op:
    enum:
    - eq
    - equal
    - ne
    - not-equal
    - gt
    - greater-than
    - ge
    - gte
    - le
    - lte
    - lt
    - less-than
    - glob
    - regex
    - regex-case
    - in
    - ni
    - not-in
    - contains
    - difference
    - intersect
    - mod
  type:
    enum:
    - advisor-recommendation
  value:
    oneOf:
    - type: array
    - type: string
    - type: boolean
    - type: number
    - type: 'null'
  value_from:
    additionalProperties: 'False'
    properties:
      expr:
        oneOf:
        - type: integer
        - type: string
      format:
        enum:
        - csv
        - json
        - txt
        - csv2dict
      headers:
        patternProperties:
          ? ''
          : type: string
        type: object
      query:
        type: string
      url:
        type: string
    required:
    - url
    type: object
  value_path:
    type: string
  value_regex:
    type: string
  value_type:
    enum:
    - age
    - integer
    - expiration
    - normalize
    - size
    - cidr
    - cidr_size
    - swap
    - resource_count
    - expr
    - unique_size
    - date
    - version
    - float
required:
- category
- type

last-execution

Find Cost Management Exports with last execution more than X days ago.

example:

Returns all cost exports that didn’t run in last 30 days.

policies:
  - name: find-stale-management-exports
    resource: azure.cost-management-export
    filters:
      - type: last-execution
        age: 30
properties:
  age:
    minimum: 0
    type: integer
  type:
    enum:
    - last-execution
required:
- age
- type

Actions

execute

Trigger Cost Management Export execution

Known issues:

If you see an error Error: (400) A valid email claim is required. Email claim is missing in the request header. please ensure used Service Principal has proper email configured.

example:

Find all exports that have not been executed in the last 30 days and then trigger a manual export.

policies:
  - name: execute-stale-management-exports
    resource: azure.cost-management-export
    filters:
      - type: last-execution
        age: 30
    actions:
      - type: execute
properties:
  type:
    enum:
    - execute
required:
- type