CostAllocationRuleCollection.CreateOrUpdate Method

Definition

Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment.

  • Request Path. : /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName}.
  • Operation Id. : CostAllocationRuleDefinitions_CreateOrUpdate.
  • Default Api Version. : 2025-03-01.
public virtual Azure.ResourceManager.ArmOperation<Azure.ResourceManager.CostManagement.CostAllocationRuleResource> CreateOrUpdate(Azure.WaitUntil waitUntil, string ruleName, Azure.ResourceManager.CostManagement.CostAllocationRuleData data, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateOrUpdate : Azure.WaitUntil * string * Azure.ResourceManager.CostManagement.CostAllocationRuleData * System.Threading.CancellationToken -> Azure.ResourceManager.ArmOperation<Azure.ResourceManager.CostManagement.CostAllocationRuleResource>
override this.CreateOrUpdate : Azure.WaitUntil * string * Azure.ResourceManager.CostManagement.CostAllocationRuleData * System.Threading.CancellationToken -> Azure.ResourceManager.ArmOperation<Azure.ResourceManager.CostManagement.CostAllocationRuleResource>
Public Overridable Function CreateOrUpdate (waitUntil As WaitUntil, ruleName As String, data As CostAllocationRuleData, Optional cancellationToken As CancellationToken = Nothing) As ArmOperation(Of CostAllocationRuleResource)

Parameters

waitUntil
WaitUntil

Completed if the method should wait to return until the long-running operation has completed on the service; Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.

ruleName
String

Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters.

data
CostAllocationRuleData

Cost allocation rule to be created or updated.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

ruleName or data is null.

ruleName is an empty string, and was expected to be non-empty.

Applies to