azure.vnet
Virtual Networks Resource
- example:
This set of policies will find all Virtual Networks that do not have DDOS protection enabled.
policies:
- name: find-vnets-ddos-protection-disabled
resource: azure.vnet
filters:
- type: value
key: properties.enableDdosProtection
op: equal
value: False
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
tag_key_transforms:
items:
type: string
type: array
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
- duration
required:
- category
- type
Actions
set-flow-log
Update the (virtual network) flow log already configured on a Virtual Network.
This only edits an existing flow log (e.g. its retention or enabled state); it
does not create one for a vnet that has none. storage-account, if given,
moves the flow log to a different storage account; otherwise the existing one
is left as-is. A vnet with no existing flow log raises a PolicyExecutionError
rather than silently creating one, since choosing a storage account and Network
Watcher for a brand-new flow log requires a decision this action doesn’t make.
- example:
Bring vnets found by the flow-logs filter into compliance with a 90-day
retention (CIS Azure Foundations 8.8).
policies:
- name: enable-vnet-flow-log-retention
resource: azure.vnet
filters:
- and:
- type: flow-logs
key: logs[0].retentionPolicy.days
op: ne
value: 0
- type: flow-logs
key: logs[0].retentionPolicy.days
op: lt
value: 90
actions:
- type: set-flow-log
enabled: true
retention: 90
properties:
enabled:
type: boolean
retention:
minimum: 0
type: integer
storage-account:
type: string
type:
enum:
- set-flow-log
required:
- type