azure.appserviceplan

Application Service Plan

example:

Find all App Service Plans that are of the Basic sku tier.

policies:
  - name: basic-tier-plans
    resource: azure.appserviceplan
    filters:
      - type: value
        key: sku.tier
        op: eq
        value: Basic

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

Actions

resize-plan

Resize App Service Plans

example:

Resize App Service Plan to B1 plan with 2 instance.

policies:
- name: azure-resize-plan
  resource: azure.appserviceplan
  actions:
   - type: resize-plan
     size: B1
     count: 2
example:

Resize app service plans with on/off hours and resource tagging

policies:
  - name: on-hours
    resource: azure.appserviceplan
    filters:
      - type: onhour
        default_tz: pt
        onhour: 8
        tag: onoffhour_schedule
    actions:
      - type: resize-plan
        size:
            type: resource
            key: tags.on_hour_sku
            default-value: P1

  - name: off-hours
    resource: azure.appserviceplan
    filters:
      - type: offhour
        default_tz: pt
        offhour: 19
        tag: onoffhour_schedule
    actions:
      - type: tag
        tag: on_hour_sku
        value:
            type: resource
            key: sku.name
      - type: resize-plan
        size: S1
anyOf:
- required:
  - size
- required:
  - count
properties:
  count:
    oneOf:
    - oneOf:
      - additionalProperties: false
        properties:
          default-value:
            type: integer
          key:
            type: string
          type:
            enum:
            - resource
            type: string
        required:
        - type
        - key
      type: object
    - type: integer
  size:
    oneOf:
    - oneOf:
      - additionalProperties: false
        properties:
          default-value:
            enum:
            - F1
            - B1
            - B2
            - B3
            - D1
            - S1
            - S2
            - S3
            - P1
            - P2
            - P3
            - P1V2
            - P2V2
            - P3v2
            - PC2
            - PC3
            - PC4
            type: string
          key:
            type: string
          type:
            enum:
            - resource
            type: string
        required:
        - type
        - key
      type: object
    - enum:
      - F1
      - B1
      - B2
      - B3
      - D1
      - S1
      - S2
      - S3
      - P1
      - P2
      - P3
      - P1V2
      - P2V2
      - P3v2
      - PC2
      - PC3
      - PC4
      type: string
  type:
    enum:
    - resize-plan