az cognitiveservices account costcontrol

Note

This reference is part of the foundry-cost-control extension for the Azure CLI (version 2.75.0 or higher). The extension will automatically install the first time you run an az cognitiveservices account costcontrol command. Learn more about extensions.

Command group 'az cognitiveservices' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Manage Cost Control Policies in Foundry.

A set of commands to manage Cost Control Policies in Foundry. Supported commands are create, delete, list, show and update. Use those policies to set a threshold on the cost (in USD) per time period for token use by your account or deployment. You can also set alerts to get notified when this threshold approaches.

Commands

Name Description Type Status
az cognitiveservices account costcontrol create

Create a cost control.

Extension Preview
az cognitiveservices account costcontrol delete

Delete a cost control.

Extension Preview
az cognitiveservices account costcontrol list

List the cost controls owned by an account.

Extension Preview
az cognitiveservices account costcontrol show

Get a cost control.

Extension Preview
az cognitiveservices account costcontrol update

Update a cost control.

Extension Preview

az cognitiveservices account costcontrol create

Preview

Command group 'az cognitiveservices account costcontrol' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Create a cost control.

az cognitiveservices account costcontrol create --account-name
                                                --cost-control-name --name
                                                --resource-group
                                                [--acquire-policy-token]
                                                [--change-reference]
                                                [--display-name]
                                                [--if-match]
                                                [--if-none-match]
                                                [--rules]

Examples

Create a cost control with all settings

az cognitive-services account cost-control create --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --if-none-match * --display-name Production agent monthly budget --rules "[{name:monthly-agent-budget,counter-key:[{type:agent}],unit:usd,amount:1000,period:month,recurring:True,match:{foundry-caller-agent-id:[customer-support-agent,sales-assistant-agent],foundry-caller-identity-oid:[11111111-2222-3333-4444-555555555555],foundry-caller-session-id:[production-session],foundry-project-id:[/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/foundry-resource-group/providers/Microsoft.CognitiveServices/accounts/foundry-account/projects/production]},thresholds:[{type:percentage,value:80,action:alert},{type:absolute,value:1000,action:audit}]},{name:daily-tenant-budget,counter-key:[{type:custom,attribute:x-tenant-id}],unit:usd,amount:100,period:day,recurring:True,thresholds:[{type:percentage,value:90,action:alert}]}]"

Required Parameters

--account-name

The name of Cognitive Services account.

--cost-control-name --name -n

The name of the CostControl.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--display-name

An optional human-readable name for the cost control.

Property Value
Parameter group: Properties Arguments
--if-match

Proceeds only when the current entity tag matches this value.

--if-none-match

Proceeds only when the current entity tag does not match this value.

--rules

The rules enforced by the cost control. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Property Value
Parameter group: Properties Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az cognitiveservices account costcontrol delete

Preview

Command group 'az cognitiveservices account costcontrol' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Delete a cost control.

az cognitiveservices account costcontrol delete [--account-name]
                                                [--acquire-policy-token]
                                                [--change-reference]
                                                [--cost-control-name --name]
                                                [--ids]
                                                [--if-match]
                                                [--resource-group]
                                                [--subscription]
                                                [--yes]

Examples

Delete a cost control conditionally

az cognitive-services account cost-control delete --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --if-match "00000000-0000-0000-0000-000000000002"

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-name

The name of Cognitive Services account.

Property Value
Parameter group: Resource Id Arguments
--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--cost-control-name --name -n

The name of the CostControl.

Property Value
Parameter group: Resource Id Arguments
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

Property Value
Parameter group: Resource Id Arguments
--if-match

Proceeds only when the current entity tag matches this value.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Property Value
Parameter group: Resource Id Arguments
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Property Value
Parameter group: Resource Id Arguments
--yes -y

Do not prompt for confirmation.

Property Value
Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az cognitiveservices account costcontrol list

Preview

Command group 'az cognitiveservices account costcontrol' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

List the cost controls owned by an account.

az cognitiveservices account costcontrol list --account-name
                                              --resource-group
                                              [--max-items]
                                              [--next-token]

Examples

List cost controls with all settings

az cognitive-services account cost-control list --resource-group foundry-resource-group --account-name foundry-account

Required Parameters

--account-name

The name of Cognitive Services account.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--max-items

Total number of items to return in the command's output. If the total number of items available is more than the value specified, a token is provided in the command's output. To resume pagination, provide the token value in --next-token argument of a subsequent command.

Property Value
Parameter group: Pagination Arguments
--next-token

Token to specify where to start paginating. This is the token value from a previously truncated response.

Property Value
Parameter group: Pagination Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az cognitiveservices account costcontrol show

Preview

Command group 'az cognitiveservices account costcontrol' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Get a cost control.

az cognitiveservices account costcontrol show [--account-name]
                                              [--cost-control-name --name]
                                              [--ids]
                                              [--resource-group]
                                              [--subscription]

Examples

Get a cost control with all settings

az cognitive-services account cost-control show --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-name

The name of Cognitive Services account.

Property Value
Parameter group: Resource Id Arguments
--cost-control-name --name -n

The name of the CostControl.

Property Value
Parameter group: Resource Id Arguments
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Property Value
Parameter group: Resource Id Arguments
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az cognitiveservices account costcontrol update

Preview

Command group 'az cognitiveservices account costcontrol' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Update a cost control.

az cognitiveservices account costcontrol update [--account-name]
                                                [--acquire-policy-token]
                                                [--add]
                                                [--change-reference]
                                                [--cost-control-name --name]
                                                [--display-name]
                                                [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                                                [--ids]
                                                [--if-match]
                                                [--if-none-match]
                                                [--remove]
                                                [--resource-group]
                                                [--rules]
                                                [--set]
                                                [--subscription]

Examples

Create a cost control with all settings

az cognitive-services account cost-control update --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --if-none-match * --display-name Production agent monthly budget --rules "[{name:monthly-agent-budget,counter-key:[{type:agent}],unit:usd,amount:1000,period:month,recurring:True,match:{foundry-caller-agent-id:[customer-support-agent,sales-assistant-agent],foundry-caller-identity-oid:[11111111-2222-3333-4444-555555555555],foundry-caller-session-id:[production-session],foundry-project-id:[/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/foundry-resource-group/providers/Microsoft.CognitiveServices/accounts/foundry-account/projects/production]},thresholds:[{type:percentage,value:80,action:alert},{type:absolute,value:1000,action:audit}]},{name:daily-tenant-budget,counter-key:[{type:custom,attribute:x-tenant-id}],unit:usd,amount:100,period:day,recurring:True,thresholds:[{type:percentage,value:90,action:alert}]}]"

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-name

The name of Cognitive Services account.

Property Value
Parameter group: Resource Id Arguments
--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

Property Value
Parameter group: Generic Update Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--cost-control-name --name -n

The name of the CostControl.

Property Value
Parameter group: Resource Id Arguments
--display-name

An optional human-readable name for the cost control.

Property Value
Parameter group: Properties Arguments
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

Property Value
Parameter group: Generic Update Arguments
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

Property Value
Parameter group: Resource Id Arguments
--if-match

Proceeds only when the current entity tag matches this value.

--if-none-match

Proceeds only when the current entity tag does not match this value.

--remove

Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove.

Property Value
Parameter group: Generic Update Arguments
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Property Value
Parameter group: Resource Id Arguments
--rules

The rules enforced by the cost control. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Property Value
Parameter group: Properties Arguments
--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>.

Property Value
Parameter group: Generic Update Arguments
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False