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'
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
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
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