diff --git a/Commands/cognitiveservices/account/costcontrol/_create.md b/Commands/cognitiveservices/account/costcontrol/_create.md index 0ba1749d9..3bbc9ebc9 100644 --- a/Commands/cognitiveservices/account/costcontrol/_create.md +++ b/Commands/cognitiveservices/account/costcontrol/_create.md @@ -23,7 +23,17 @@ Create an account-owned cost control. The definition may contain at most one not #### examples -- Create or replace an account cost budget +- Cap the whole Foundry resource at $1000 a month and block at 100% ```bash - cognitiveservices account costcontrol create --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --if-none-match * --grouping "[{name:agent,type:AdditionalInfoKey}]" --category Cost --amount 1000 --time-grain Monthly --time-period "{start-date:'2026-11-15T00:00:00Z',end-date:'2027-11-15T00:00:00Z'}" --filter "{and:[{additionalInfo:{name:project,operator:In,values:[production]}},{additionalInfo:{name:agent,operator:In,values:[customer-support,order-assistant]}},{additionalInfo:{name:deployment,operator:In,values:[customer-support-model]}}]}" --notifications "{usageAlert:{eventGridConnectionId:/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/foundry-resource-group/providers/Microsoft.CognitiveServices/accounts/foundry-account/connections/budget-alerts,thresholdType:Percentage,threshold:80,enabled:True,operator:GreaterThanOrEqualTo}}" --provider-properties "{actions:{stopRequests:{type:Block,thresholdType:Percentage,threshold:100,operator:GreaterThanOrEqualTo}}}" + cognitiveservices account costcontrol create --resource-group foundry-resource-group --account-name foundry-account --cost-control-name monthly-cap --category Cost --amount 1000 --time-grain Monthly --time-period "{start-date:'2026-12-01T00:00:00Z',end-date:'2027-12-01T00:00:00Z'}" --provider-properties "{actions:{block-at-100:{type:Block,threshold-type:Percentage,threshold:100,operator:GreaterThanOrEqualTo}}}" + ``` + +- Cap at $1000 a month, alert at 80% but do not block + ```bash + cognitiveservices account costcontrol create --resource-group foundry-resource-group --account-name foundry-account --cost-control-name monthly-cap --category Cost --amount 1000 --time-grain Monthly --time-period "{start-date:'2026-12-01T00:00:00Z',end-date:'2027-12-01T00:00:00Z'}" --notifications "{usage-alert:{event-grid-connection-id:/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/foundry-resource-group/providers/Microsoft.CognitiveServices/accounts/foundry-account/connections/budget-alerts,threshold-type:Percentage,threshold:80,enabled:true,operator:GreaterThanOrEqualTo}}" + ``` + +- Example using full settings (filters, grouping, alert and block) + ```bash + cognitiveservices account costcontrol create --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --if-none-match * --grouping "[{name:agent,type:AdditionalInfoKey}]" --category Cost --amount 1000 --time-grain Monthly --time-period "{start-date:'2026-11-15T00:00:00Z',end-date:'2027-11-15T00:00:00Z'}" --filter "{and:[{additional-info:{name:project,operator:In,values:[production]}},{additional-info:{name:agent,operator:In,values:[customer-support,order-assistant]}},{additional-info:{name:deployment,operator:In,values:[customer-support-model]}}]}" --notifications "{usage-alert:{event-grid-connection-id:/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/foundry-resource-group/providers/Microsoft.CognitiveServices/accounts/foundry-account/connections/budget-alerts,threshold-type:Percentage,threshold:80,enabled:True,operator:GreaterThanOrEqualTo}}" --provider-properties "{actions:{stop-requests:{type:Block,threshold-type:Percentage,threshold:100,operator:GreaterThanOrEqualTo}}}" ``` diff --git a/Commands/cognitiveservices/account/costcontrol/_delete.md b/Commands/cognitiveservices/account/costcontrol/_delete.md index 493eb7aa1..3296b891d 100644 --- a/Commands/cognitiveservices/account/costcontrol/_delete.md +++ b/Commands/cognitiveservices/account/costcontrol/_delete.md @@ -21,7 +21,12 @@ Delete an account-owned cost control. #### examples -- Delete a budget conditionally +- Delete a budget ```bash - cognitiveservices account costcontrol delete --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --if-match "00000000-0000-0000-0000-000000000001" + cognitiveservices account costcontrol delete --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents + ``` + +- Delete a budget if the account entity tag matches the given one. Note the required forward slash before the quotation marks around the entity tag. + ```bash + cognitiveservices account costcontrol delete --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --if-match \"c6d292d2-521f-4f7f-ab38-1be7e4a56e9e.additional-info\" ``` diff --git a/Commands/cognitiveservices/account/costcontrol/_update.md b/Commands/cognitiveservices/account/costcontrol/_update.md index d0dc2e880..92ce52d84 100644 --- a/Commands/cognitiveservices/account/costcontrol/_update.md +++ b/Commands/cognitiveservices/account/costcontrol/_update.md @@ -23,7 +23,27 @@ Omitting properties preserves all existing cost control properties; setting prop #### examples -- Create or replace an account cost budget +- Update the account's cap to $1500 per the previously set period ```bash - cognitiveservices account costcontrol update --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --if-none-match * --grouping "[{name:agent,type:AdditionalInfoKey}]" --category Cost --amount 1000 --time-grain Monthly --time-period "{start-date:'2026-11-15T00:00:00Z',end-date:'2027-11-15T00:00:00Z'}" --filter "{and:[{additionalInfo:{name:project,operator:In,values:[production]}},{additionalInfo:{name:agent,operator:In,values:[customer-support,order-assistant]}},{additionalInfo:{name:deployment,operator:In,values:[customer-support-model]}}]}" --notifications "{usageAlert:{eventGridConnectionId:/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/foundry-resource-group/providers/Microsoft.CognitiveServices/accounts/foundry-account/connections/budget-alerts,thresholdType:Percentage,threshold:80,enabled:True,operator:GreaterThanOrEqualTo}}" --provider-properties "{actions:{stopRequests:{type:Block,thresholdType:Percentage,threshold:100,operator:GreaterThanOrEqualTo}}}" + cognitiveservices account costcontrol update --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --amount 1500 + ``` + +- Update the account's cap to $1500 per the previously set period, if the account entity tag matches the given one. Note the required forward slash before the quotation marks around the entity tag. + ```bash + cognitiveservices account costcontrol update --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --amount 1500 --if-match \"bb926e0d-880b-4d60-8d59-9a341fa826a2.additional-info\" + ``` + +- Update the account's budget end date + ```bash + cognitiveservices account costcontrol update --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --set properties.timePeriod.endDate="2028-12-01T00:00:00Z" + ``` + +- Update the account's budget notification threshold to 90% + ```bash + cognitiveservices account costcontrol update --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --set properties.notifications.usageAlert.threshold=90 + ``` + +- Example using full settings (filters, grouping, alert and block) + ```bash + cognitiveservices account costcontrol update --resource-group foundry-resource-group --account-name foundry-account --cost-control-name production-agents --grouping "[{name:agent,type:AdditionalInfoKey}]" --category Cost --amount 1000 --time-grain Monthly --time-period "{start-date:'2026-11-15T00:00:00Z',end-date:'2027-11-15T00:00:00Z'}" --filter "{and:[{additional-info:{name:project,operator:In,values:[production]}},{additional-info:{name:agent,operator:In,values:[customer-support,order-assistant]}},{additional-info:{name:deployment,operator:In,values:[customer-support-model]}}]}" --notifications "{usage-alert:{event-grid-connection-id:/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/foundry-resource-group/providers/Microsoft.CognitiveServices/accounts/foundry-account/connections/budget-alerts,threshold-type:Percentage,threshold:80,enabled:True,operator:GreaterThanOrEqualTo}}" --provider-properties "{actions:{stop-requests:{type:Block,threshold-type:Percentage,threshold:100,operator:GreaterThanOrEqualTo}}}" ``` diff --git a/Commands/cognitiveservices/account/project/costcontrol/_create.md b/Commands/cognitiveservices/account/project/costcontrol/_create.md index 5d6bfe924..68dc68cb9 100644 --- a/Commands/cognitiveservices/account/project/costcontrol/_create.md +++ b/Commands/cognitiveservices/account/project/costcontrol/_create.md @@ -1,8 +1,8 @@ # [Command] _cognitiveservices account project costcontrol create_ -Create a Foundry project-owned const control. +Create a Foundry project-owned cost control. -Create a Foundry project-owned const control. The definition may contain at most one notification, including disabled notifications, and one Block action. Exceeding either limit returns HTTP 400 without persisting the request. +Create a Foundry project-owned cost control. The definition may contain at most one notification, including disabled notifications, and one Block action. Exceeding either limit returns HTTP 400 without persisting the request. ## Versions @@ -12,7 +12,12 @@ Create a Foundry project-owned const control. The definition may contain at most #### examples -- Create or replace a project token budget +- Cap at 2M tokens a day, alert when reaching 80% and block at 100% ```bash - cognitiveservices account project costcontrol create --resource-group foundry-resource-group --account-name foundry-account --project-name production --cost-control-name project-token-budget --if-none-match * --category Tokens --amount 1000000 --time-grain Daily --time-period "{start-date:'2026-11-15T00:00:00Z',end-date:'2027-11-15T00:00:00Z'}" --filter "{additionalInfo:{name:tokenType,operator:In,values:[input,output]}}" --notifications "{usageAlert:{eventGridConnectionId:/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/foundry-resource-group/providers/Microsoft.CognitiveServices/accounts/foundry-account/connections/budget-alerts,thresholdType:Percentage,threshold:80,enabled:True,operator:GreaterThanOrEqualTo}}" --provider-properties "{actions:{stopRequests:{type:Block,thresholdType:Percentage,threshold:100,operator:GreaterThanOrEqualTo}}}" + cognitiveservices account project costcontrol create --resource-group foundry-resource-group --account-name foundry-account --project-name production --cost-control-name project-token-budget --if-none-match * --category Tokens --amount 2000000 --time-grain Daily --time-period "{start-date:'2026-11-15T00:00:00Z',end-date:'2027-11-15T00:00:00Z'}" --filter "{additional-info:{name:tokenType,operator:In,values:[input,output]}}" --notifications "{usageAlert:{eventGridConnectionId:/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/foundry-resource-group/providers/Microsoft.CognitiveServices/accounts/foundry-account/connections/budget-alerts,thresholdType:Percentage,threshold:80,enabled:True,operator:GreaterThanOrEqualTo}}" --provider-properties "{actions:{stopRequests:{type:Block,thresholdType:Percentage,threshold:100,operator:GreaterThanOrEqualTo}}}" + ``` + +- Example using full settings (filters, alert and block) + ```bash + cognitiveservices account project costcontrol create --resource-group foundry-resource-group --account-name foundry-account --project-name production --cost-control-name project-token-budget --if-none-match * --category Tokens --amount 1000000 --time-grain Daily --time-period "{start-date:'2026-11-15T00:00:00Z',end-date:'2027-11-15T00:00:00Z'}" --filter "{additional-info:{name:tokenType,operator:In,values:[input,output]}}" --notifications "{usage-alert:{event-grid-connection-id:/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/foundry-resource-group/providers/Microsoft.CognitiveServices/accounts/foundry-account/connections/budget-alerts,threshold-type:Percentage,threshold:80,enabled:True,operator:GreaterThanOrEqualTo}}" --provider-properties "{actions:{stop-requests:{type:Block,threshold-type:Percentage,threshold:100,operator:GreaterThanOrEqualTo}}}" ``` diff --git a/Commands/cognitiveservices/account/project/costcontrol/_delete.md b/Commands/cognitiveservices/account/project/costcontrol/_delete.md index 060ae45d6..04e2f6092 100644 --- a/Commands/cognitiveservices/account/project/costcontrol/_delete.md +++ b/Commands/cognitiveservices/account/project/costcontrol/_delete.md @@ -10,7 +10,12 @@ Delete a project-owned cost control. #### examples -- Delete a budget conditionally +- Delete a budget ```bash - cognitiveservices account project costcontrol delete --resource-group foundry-resource-group --account-name foundry-account --project-name production --cost-control-name project-token-budget --if-match "00000000-0000-0000-0000-000000000001" + cognitiveservices account project costcontrol delete --resource-group foundry-resource-group --account-name foundry-account --project-name production --cost-control-name project-token-budget + ``` + +- Delete a budget if the project entity tag matches the given one. Note the required forward slash before the quotation marks around the entity tag. + ```bash + cognitiveservices account project costcontrol delete --resource-group foundry-resource-group --account-name foundry-account --project-name production --cost-control-name project-token-budget --if-match \"bb926e0d-880b-4d60-8d59-9a341fa826a2.additional-info\" ``` diff --git a/Commands/cognitiveservices/account/project/costcontrol/_update.md b/Commands/cognitiveservices/account/project/costcontrol/_update.md index 826b77ae6..f2babb115 100644 --- a/Commands/cognitiveservices/account/project/costcontrol/_update.md +++ b/Commands/cognitiveservices/account/project/costcontrol/_update.md @@ -1,6 +1,6 @@ # [Command] _cognitiveservices account project costcontrol update_ -Updates a Foundry project-owned const control. +Updates a Foundry project-owned cost control. Updates a Foundry project cost control. Omitting properties preserves all existing cost control properties; setting properties to null or an empty object ({}) clears them all. A non-empty properties object updates selected fields, preserving omitted fields; a successful update that leaves the cost control unchanged retains its entity tag. The complete merged result may contain at most one notification, including disabled notifications, and one Block action. Exceeding either limit returns HTTP 400 without changing the stored definition. @@ -12,7 +12,17 @@ Updates a Foundry project cost control. Omitting properties preserves all existi #### examples -- Create or replace a project token budget +- Update alert threshold to 90% ```bash - cognitiveservices account project costcontrol update --resource-group foundry-resource-group --account-name foundry-account --project-name production --cost-control-name project-token-budget --if-none-match * --category Tokens --amount 1000000 --time-grain Daily --time-period "{start-date:'2026-11-15T00:00:00Z',end-date:'2027-11-15T00:00:00Z'}" --filter "{additionalInfo:{name:tokenType,operator:In,values:[input,output]}}" --notifications "{usageAlert:{eventGridConnectionId:/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/foundry-resource-group/providers/Microsoft.CognitiveServices/accounts/foundry-account/connections/budget-alerts,thresholdType:Percentage,threshold:80,enabled:True,operator:GreaterThanOrEqualTo}}" --provider-properties "{actions:{stopRequests:{type:Block,thresholdType:Percentage,threshold:100,operator:GreaterThanOrEqualTo}}}" + cognitiveservices account project costcontrol update --resource-group foundry-resource-group --account-name foundry-account --project-name production --cost-control-name project-token-budget --set properties.notifications.usageAlert.threshold=90 + ``` + +- Update alert threshold to 90%, if the project entity tag matches the given one. Note the required forward slash before the quotation marks around the entity tag. + ```bash + cognitiveservices account project costcontrol update --resource-group foundry-resource-group --account-name foundry-account --project-name production --cost-control-name project-token-budget --if-match \"bb926e0d-880b-4d60-8d59-9a341fa826a2.additional-info\" --set properties.notifications.usageAlert.threshold=90 + ``` + +- Example using full settings (filters, alert and block) + ```bash + cognitiveservices account project costcontrol update --resource-group foundry-resource-group --account-name foundry-account --project-name production --cost-control-name project-token-budget --category Tokens --amount 1000000 --time-grain Daily --time-period "{start-date:'2026-11-15T00:00:00Z',end-date:'2027-11-15T00:00:00Z'}" --filter "{additional-info:{name:tokenType,operator:In,values:[input,output]}}" --notifications "{usage-alert:{event-grid-connection-id:/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/foundry-resource-group/providers/Microsoft.CognitiveServices/accounts/foundry-account/connections/budget-alerts,threshold-type:Percentage,threshold:80,enabled:True,operator:GreaterThanOrEqualTo}}" --provider-properties "{actions:{stop-requests:{type:Block,threshold-type:Percentage,threshold:100,operator:GreaterThanOrEqualTo}}}" ``` diff --git a/Commands/cognitiveservices/account/project/costcontrol/readme.md b/Commands/cognitiveservices/account/project/costcontrol/readme.md index 922553d74..0a8ab7341 100644 --- a/Commands/cognitiveservices/account/project/costcontrol/readme.md +++ b/Commands/cognitiveservices/account/project/costcontrol/readme.md @@ -5,7 +5,7 @@ Manage Foundry project-owned cost controls ## Commands - [create](/Commands/cognitiveservices/account/project/costcontrol/_create.md) -: Create a Foundry project-owned const control. +: Create a Foundry project-owned cost control. - [delete](/Commands/cognitiveservices/account/project/costcontrol/_delete.md) : Delete a project-owned cost control. @@ -20,4 +20,4 @@ Manage Foundry project-owned cost controls : Get a project-owned cost control and its representation entity tag. - [update](/Commands/cognitiveservices/account/project/costcontrol/_update.md) -: Updates a Foundry project-owned const control. +: Updates a Foundry project-owned cost control.