azure.cosmosdb-collection
CosmosDB Collection Resource
- example:
This policy will find all collections with Offer Throughput > 100
policies:
- name: cosmosdb-high-throughput
resource: azure.cosmosdb-collection
filters:
- type: offer
key: content.offerThroughput
op: gt
value: 100
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
replace-offer
CosmosDB Replace Offer Action
Modify the throughput of a cosmodb collection’s offer
- example:
This policy will ensure that no collections have offers with more than 400 RU/s throughput.
policies:
- name: limit-throughput-to-400
resource: azure.cosmosdb-collection
filters:
- type: offer
key: content.offerThroughput
op: gt
value: 400
actions:
- type: replace-offer
throughput: 400
properties:
throughput:
type: number
type:
enum:
- replace-offer
required:
- throughput
- type
restore-throughput-state
CosmosDB Restore State Action
Restores the throughput of a cosmodb collection’s offer from state stored in a tag on the collections’s parent CosmosDB account.
- example:
This policy will restore the state of Cosmos DB collections by retrieving the state from the tag ‘on-hour-state’ from its associated Cosmos DB account.
policies:
- name: restore-throughput-state
resource: azure.cosmosdb-collection
actions:
- type: restore-throughput-state
state-tag: on-hour-state
properties:
state-tag:
type: string
type:
enum:
- restore-throughput-state
required:
- state-tag
- type
save-throughput-state
CosmosDB Store State Action
Stores the throughput of collections in a tag on the parent Cosmos DB account. With accounts that have many collections, it’s important to filter down which collections to store since there is a tag length limit (approx 16 collections).
- example:
This policy saves the throughput of collections with throughput over 400 in a tag called ‘on-hour-state’ on the parent Cosmos DB account.
policies:
- name: store-on-hours-state
resource: azure.cosmosdb-collection
filters:
- type: offer
key: content.offerThroughput
op: gt
value: 400
actions:
- type: save-throughput-state
state-tag: on-hour-state
properties:
state-tag:
type: string
type:
enum:
- save-throughput-state
required:
- state-tag
- type