Microsoft.CognitiveServices accounts/costControls

Bicep resource definition

The accounts/costControls resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.CognitiveServices/accounts/costControls resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.CognitiveServices/accounts/costControls@2026-09-15-preview' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    displayName: 'string'
    rules: [
      {
        amount: int
        counterKey: {
          type: 'string'
        }
        match: {
          agentResourceIds: [
            'string'
          ]
          identityObjectIds: [
            'string'
          ]
          projectIds: [
            'string'
          ]
          sessionIds: [
            'string'
          ]
        }
        name: 'string'
        period: 'string'
        recurring: bool
        thresholds: [
          {
            action: 'string'
            type: 'string'
            value: int
          }
        ]
        unit: 'string'
      }
    ]
  }
}

Property Values

Microsoft.CognitiveServices/accounts/costControls

Name Description Value
name The resource name string

Constraints:
Pattern = ^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,63}$ (required)
parent In Bicep, you can specify the parent resource for a child resource. You only need to add this property when the child resource is declared outside of the parent resource.

For more information, see Child resource outside parent resource.
Symbolic name for resource of type: accounts
properties The resource-specific properties for this resource. CostControlProperties

CostControlDimension

Name Description Value
type The kind of request dimension. 'Account'
'Agent'
'Custom'
'Identity'
'Project'
'Session' (required)

CostControlMatch

Name Description Value
agentResourceIds Agent resource IDs use /subscriptions/{subscription_guid}/accounts/{account-name}/project/{project-name}/agent/{agent_name}. string

Constraints:
Min length = 1[]
identityObjectIds The authenticated principal object IDs to match. string

Constraints:
Min length = 1[]
projectIds The Foundry project resource IDs to match. string[]
sessionIds The Foundry session IDs to match. string

Constraints:
Min length = 1[]

CostControlProperties

Name Description Value
displayName An optional human-readable name for the cost control. string

Constraints:
Max length = 128
rules The rules enforced by the cost control. CostControlRule[] (required)

CostControlRule

Name Description Value
amount The maximum consumption allowed by this rule, expressed in the selected unit. int (required)
counterKey Gets or sets the single built-in dimension used to partition consumption.
Custom dimensions are retained only for legacy reads and metadata-only updates.
Legacy singleton arrays are accepted on read; serialization always emits an object.
To track another field, create another rule.
CostControlDimension (required)
match Gets or sets optional match arrays keyed by agentResourceIds, identityObjectIds,
sessionIds, or projectIds. Each array contains 1 to 20 non-empty values.
Agent resource IDs use /subscriptions/{subscription_guid}/accounts/{account-name}/project/{project-name}/agent/{agent_name}.
Legacy dotted identity, session, and project keys remain accepted, but cannot be combined with their canonical key.
CostControlMatch
name The stable rule identifier, unique within the cost control without regard to case. string

Constraints:
Max length = 64
Pattern = ^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,63}$ (required)
period Gets or sets the calendar-aligned UTC renewal period. Authored rules support Day, Week, or Month.
This field is required for recurring rules and must be omitted for non-recurring rules.
Legacy stored minute, hour, and year periods are preserved when reading definitions.
'Day'
'Hour'
'Minute'
'Month'
'Week'
'Year'
recurring Whether the cost control renews. The default is true. bool
thresholds Gets or sets optional thresholds. Omitted or empty thresholds track usage without explicit actions.
Authored thresholds must explicitly specify Alert or Block; Audit is retained for legacy reads.
CostControlThreshold[]
unit The unit used for the cost control amount and absolute thresholds. 'Usd' (required)

CostControlThreshold

Name Description Value
action Gets or sets the threshold action. Authored thresholds must explicitly specify Alert or Block.
Legacy stored definitions with omitted actions continue to read as Audit.
'Alert'
'Audit'
'Block' (required)
type How the threshold value is interpreted. 'Absolute'
'Percentage' (required)
value Gets or sets the threshold value. Legacy Audit definitions retain their stored values;
new thresholds support only Alert or Block.
int

Constraints:
Min value = 0 (required)

ARM template resource definition

The accounts/costControls resource type can be deployed with operations that target:

Usage Examples

Resource format

To create a Microsoft.CognitiveServices/accounts/costControls resource, add the following JSON to your template.

{
  "type": "Microsoft.CognitiveServices/accounts/costControls",
  "apiVersion": "2026-09-15-preview",
  "name": "string",
  "properties": {
    "displayName": "string",
    "rules": [
      {
        "amount": "int",
        "counterKey": {
          "type": "string"
        },
        "match": {
          "agentResourceIds": [ "string" ],
          "identityObjectIds": [ "string" ],
          "projectIds": [ "string" ],
          "sessionIds": [ "string" ]
        },
        "name": "string",
        "period": "string",
        "recurring": "bool",
        "thresholds": [
          {
            "action": "string",
            "type": "string",
            "value": "int"
          }
        ],
        "unit": "string"
      }
    ]
  }
}

Property Values

Microsoft.CognitiveServices/accounts/costControls

Name Description Value
apiVersion The api version '2026-09-15-preview'
name The resource name string

Constraints:
Pattern = ^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,63}$ (required)
properties The resource-specific properties for this resource. CostControlProperties
type The resource type 'Microsoft.CognitiveServices/accounts/costControls'

CostControlDimension

Name Description Value
type The kind of request dimension. 'Account'
'Agent'
'Custom'
'Identity'
'Project'
'Session' (required)

CostControlMatch

Name Description Value
agentResourceIds Agent resource IDs use /subscriptions/{subscription_guid}/accounts/{account-name}/project/{project-name}/agent/{agent_name}. string

Constraints:
Min length = 1[]
identityObjectIds The authenticated principal object IDs to match. string

Constraints:
Min length = 1[]
projectIds The Foundry project resource IDs to match. string[]
sessionIds The Foundry session IDs to match. string

Constraints:
Min length = 1[]

CostControlProperties

Name Description Value
displayName An optional human-readable name for the cost control. string

Constraints:
Max length = 128
rules The rules enforced by the cost control. CostControlRule[] (required)

CostControlRule

Name Description Value
amount The maximum consumption allowed by this rule, expressed in the selected unit. int (required)
counterKey Gets or sets the single built-in dimension used to partition consumption.
Custom dimensions are retained only for legacy reads and metadata-only updates.
Legacy singleton arrays are accepted on read; serialization always emits an object.
To track another field, create another rule.
CostControlDimension (required)
match Gets or sets optional match arrays keyed by agentResourceIds, identityObjectIds,
sessionIds, or projectIds. Each array contains 1 to 20 non-empty values.
Agent resource IDs use /subscriptions/{subscription_guid}/accounts/{account-name}/project/{project-name}/agent/{agent_name}.
Legacy dotted identity, session, and project keys remain accepted, but cannot be combined with their canonical key.
CostControlMatch
name The stable rule identifier, unique within the cost control without regard to case. string

Constraints:
Max length = 64
Pattern = ^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,63}$ (required)
period Gets or sets the calendar-aligned UTC renewal period. Authored rules support Day, Week, or Month.
This field is required for recurring rules and must be omitted for non-recurring rules.
Legacy stored minute, hour, and year periods are preserved when reading definitions.
'Day'
'Hour'
'Minute'
'Month'
'Week'
'Year'
recurring Whether the cost control renews. The default is true. bool
thresholds Gets or sets optional thresholds. Omitted or empty thresholds track usage without explicit actions.
Authored thresholds must explicitly specify Alert or Block; Audit is retained for legacy reads.
CostControlThreshold[]
unit The unit used for the cost control amount and absolute thresholds. 'Usd' (required)

CostControlThreshold

Name Description Value
action Gets or sets the threshold action. Authored thresholds must explicitly specify Alert or Block.
Legacy stored definitions with omitted actions continue to read as Audit.
'Alert'
'Audit'
'Block' (required)
type How the threshold value is interpreted. 'Absolute'
'Percentage' (required)
value Gets or sets the threshold value. Legacy Audit definitions retain their stored values;
new thresholds support only Alert or Block.
int

Constraints:
Min value = 0 (required)

Terraform (AzAPI provider) resource definition

The accounts/costControls resource type can be deployed with operations that target:

  • Resource groups For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.CognitiveServices/accounts/costControls resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.CognitiveServices/accounts/costControls@2026-09-15-preview"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      displayName = "string"
      rules = [
        {
          amount = int
          counterKey = {
            type = "string"
          }
          match = {
            agentResourceIds = [
              "string"
            ]
            identityObjectIds = [
              "string"
            ]
            projectIds = [
              "string"
            ]
            sessionIds = [
              "string"
            ]
          }
          name = "string"
          period = "string"
          recurring = bool
          thresholds = [
            {
              action = "string"
              type = "string"
              value = int
            }
          ]
          unit = "string"
        }
      ]
    }
  }
}

Property Values

Microsoft.CognitiveServices/accounts/costControls

Name Description Value
name The resource name string

Constraints:
Pattern = ^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,63}$ (required)
parent_id The ID of the resource that is the parent for this resource. ID for resource of type: accounts
properties The resource-specific properties for this resource. CostControlProperties
type The resource type "Microsoft.CognitiveServices/accounts/costControls@2026-09-15-preview"

CostControlDimension

Name Description Value
type The kind of request dimension. 'Account'
'Agent'
'Custom'
'Identity'
'Project'
'Session' (required)

CostControlMatch

Name Description Value
agentResourceIds Agent resource IDs use /subscriptions/{subscription_guid}/accounts/{account-name}/project/{project-name}/agent/{agent_name}. string

Constraints:
Min length = 1[]
identityObjectIds The authenticated principal object IDs to match. string

Constraints:
Min length = 1[]
projectIds The Foundry project resource IDs to match. string[]
sessionIds The Foundry session IDs to match. string

Constraints:
Min length = 1[]

CostControlProperties

Name Description Value
displayName An optional human-readable name for the cost control. string

Constraints:
Max length = 128
rules The rules enforced by the cost control. CostControlRule[] (required)

CostControlRule

Name Description Value
amount The maximum consumption allowed by this rule, expressed in the selected unit. int (required)
counterKey Gets or sets the single built-in dimension used to partition consumption.
Custom dimensions are retained only for legacy reads and metadata-only updates.
Legacy singleton arrays are accepted on read; serialization always emits an object.
To track another field, create another rule.
CostControlDimension (required)
match Gets or sets optional match arrays keyed by agentResourceIds, identityObjectIds,
sessionIds, or projectIds. Each array contains 1 to 20 non-empty values.
Agent resource IDs use /subscriptions/{subscription_guid}/accounts/{account-name}/project/{project-name}/agent/{agent_name}.
Legacy dotted identity, session, and project keys remain accepted, but cannot be combined with their canonical key.
CostControlMatch
name The stable rule identifier, unique within the cost control without regard to case. string

Constraints:
Max length = 64
Pattern = ^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,63}$ (required)
period Gets or sets the calendar-aligned UTC renewal period. Authored rules support Day, Week, or Month.
This field is required for recurring rules and must be omitted for non-recurring rules.
Legacy stored minute, hour, and year periods are preserved when reading definitions.
'Day'
'Hour'
'Minute'
'Month'
'Week'
'Year'
recurring Whether the cost control renews. The default is true. bool
thresholds Gets or sets optional thresholds. Omitted or empty thresholds track usage without explicit actions.
Authored thresholds must explicitly specify Alert or Block; Audit is retained for legacy reads.
CostControlThreshold[]
unit The unit used for the cost control amount and absolute thresholds. 'Usd' (required)

CostControlThreshold

Name Description Value
action Gets or sets the threshold action. Authored thresholds must explicitly specify Alert or Block.
Legacy stored definitions with omitted actions continue to read as Audit.
'Alert'
'Audit'
'Block' (required)
type How the threshold value is interpreted. 'Absolute'
'Percentage' (required)
value Gets or sets the threshold value. Legacy Audit definitions retain their stored values;
new thresholds support only Alert or Block.
int

Constraints:
Min value = 0 (required)