App Service Plan

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
  • onhour

    Schema:

    {
      "default_tz": {
        "required": true,
        "type": "string"
      },
      "onhour": {
        "maximum": 23,
        "minimum": 0,
        "required": true,
        "type": "integer"
      },
      "opt-out": {
        "type": "boolean"
      },
      "skip-days": {
        "items": {
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}",
          "type": "string"
        },
        "type": "array"
      },
      "skip-days-from": {
        "additionalProperties": "False",
        "properties": {
          "expr": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          "format": {
            "enum": [
              "csv",
              "json",
              "txt",
              "csv2dict"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "type": "object"
      },
      "tag": {
        "type": "string"
      },
      "weekends": {
        "type": "boolean"
      },
      "weekends-only": {
        "type": "boolean"
      }
    }
    
  • offhour

    Schema:

    {
      "default_tz": {
        "required": true,
        "type": "string"
      },
      "offhour": {
        "maximum": 23,
        "minimum": 0,
        "required": true,
        "type": "integer"
      },
      "opt-out": {
        "type": "boolean"
      },
      "skip-days": {
        "items": {
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}",
          "type": "string"
        },
        "type": "array"
      },
      "skip-days-from": {
        "additionalProperties": "False",
        "properties": {
          "expr": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          "format": {
            "enum": [
              "csv",
              "json",
              "txt",
              "csv2dict"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "type": "object"
      },
      "tag": {
        "type": "string"
      },
      "weekends": {
        "type": "boolean"
      },
      "weekends-only": {
        "type": "boolean"
      }
    }
    

Actions

  • ARM Resource Actions (see Generic Actions)

  • resize-plan Resize an app service plan by changing either the SKU or the number of instances.

    Schema:

    {
      "count": {
        "type": "integer"
      },
      "size": {
        "enum": [
          "F1",
          "B1",
          "B2",
          "B3",
          "D1",
          "S1",
          "S2",
          "S3",
          "P1",
          "P2",
          "P3",
          "P1V2",
          "P2V2",
          "P3v2",
          "PC2",
          "PC3",
          "PC4"
        ],
        "type": "string"
      }
    }
    

Example Policies

This set of policies will mark all app services 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-appservice-for-deletion
    resource: azure.appserviceplan
    filters:
      - type: value
        key: name
        op: in
        value_type: normalize
        value: test
     actions:
      - type: mark-for-op
        op: delete
        days: 7
  - name: delete-test-appservice
    resource: azure.appserviceplan
    filters:
      - type: marked-for-op
        op: delete
    actions:
      - type: delete