Microsoft.CostManagement/costAllocationRules – Bicep, ARM template & Terraform AzAPI reference

Table of Contents0.1 In this article1 Bicep resource definition2 Resource format3 Property values3.1 costAllocationRules3.2 CostAllocationRuleProperties3.3 CostAllocationRuleDetails3.4 SourceCostAllocationResource3.5 TargetCostAllocationResource3.6 CostAllocationProportion4 ARM template resource definition5 Resource format6 Property values6.1 costAllocationRules6.2 CostAllocationRuleProperties6.3 CostAllocationRuleDetails6.4 SourceCostAllocationResource6.5 TargetCostAllocationResource6.6 CostAllocationProportion7 Terraform (AzAPI provider) resource definition8 Resource format9 Property values9.1 costAllocationRules9.2 CostAllocationRuleProperties9.3 CostAllocationRuleDetails9.4 SourceCostAllocationResource9.5 TargetCostAllocationResource9.6 CostAllocationProportion […]

Bicep resource definition

The costAllocationRules resource type can be deployed to:

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

Resource format

To create a Microsoft.CostManagement/costAllocationRules resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.CostManagement/costAllocationRules@2020-03-01-preview' = {
  name: 'string'
  properties: {
    description: 'string'
    details: {
      sourceResources: [
        {
          name: 'string'
          resourceType: 'string'
          values: [
            'string'
          ]
        }
      ]
      targetResources: [
        {
          name: 'string'
          policyType: 'FixedProportion'
          resourceType: 'string'
          values: [
            {
              name: 'string'
              percentage: int
            }
          ]
        }
      ]
    }
    status: 'string'
  }
}

Property values

costAllocationRules

CostAllocationRuleProperties

Name Description Value
description Description of a cost allocation rule. string
details Resource information for the cost allocation rule CostAllocationRuleDetails (required)
status Status of the rule ‘Active’
‘NotActive’
‘Processing’ (required)

CostAllocationRuleDetails

Name Description Value
sourceResources Source resources for cost allocation. At this time, this list can contain no more than one element. SourceCostAllocationResource[]
targetResources Target resources for cost allocation. At this time, this list can contain no more than one element. TargetCostAllocationResource[]

SourceCostAllocationResource

Name Description Value
name If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag string (required)
resourceType Type of resources contained in this cost allocation rule ‘Dimension’
‘Tag’ (required)
values Source Resources for cost allocation. This list cannot contain more than 25 values. string[] (required)

TargetCostAllocationResource

Name Description Value
name If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag string (required)
policyType Method of cost allocation for the rule ‘FixedProportion’ (required)
resourceType Type of resources contained in this cost allocation rule ‘Dimension’
‘Tag’ (required)
values Target resources for cost allocation. This list cannot contain more than 25 values. CostAllocationProportion[] (required)

CostAllocationProportion

Name Description Value
name Target resource for cost allocation string (required)
percentage Percentage of source cost to allocate to this resource. This value can be specified to two decimal places and the total percentage of all resources in this rule must sum to 100.00. int (required)

ARM template resource definition

The costAllocationRules resource type can be deployed to:

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

Resource format

To create a Microsoft.CostManagement/costAllocationRules resource, add the following JSON to your template.

{
  "type": "Microsoft.CostManagement/costAllocationRules",
  "apiVersion": "2020-03-01-preview",
  "name": "string",
  "properties": {
    "description": "string",
    "details": {
      "sourceResources": [
        {
          "name": "string",
          "resourceType": "string",
          "values": [ "string" ]
        }
      ],
      "targetResources": [
        {
          "name": "string",
          "policyType": "FixedProportion",
          "resourceType": "string",
          "values": [
            {
              "name": "string",
              "percentage": "int"
            }
          ]
        }
      ]
    },
    "status": "string"
  }
}

Property values

costAllocationRules

Name Description Value
type The resource type ‘Microsoft.CostManagement/costAllocationRules’
apiVersion The resource api version ‘2020-03-01-preview’
name The resource name string (required)
properties Cost allocation rule properties CostAllocationRuleProperties

CostAllocationRuleProperties

Name Description Value
description Description of a cost allocation rule. string
details Resource information for the cost allocation rule CostAllocationRuleDetails (required)
status Status of the rule ‘Active’
‘NotActive’
‘Processing’ (required)

CostAllocationRuleDetails

Name Description Value
sourceResources Source resources for cost allocation. At this time, this list can contain no more than one element. SourceCostAllocationResource[]
targetResources Target resources for cost allocation. At this time, this list can contain no more than one element. TargetCostAllocationResource[]

SourceCostAllocationResource

Name Description Value
name If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag string (required)
resourceType Type of resources contained in this cost allocation rule ‘Dimension’
‘Tag’ (required)
values Source Resources for cost allocation. This list cannot contain more than 25 values. string[] (required)

TargetCostAllocationResource

Name Description Value
name If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag string (required)
policyType Method of cost allocation for the rule ‘FixedProportion’ (required)
resourceType Type of resources contained in this cost allocation rule ‘Dimension’
‘Tag’ (required)
values Target resources for cost allocation. This list cannot contain more than 25 values. CostAllocationProportion[] (required)

CostAllocationProportion

Name Description Value
name Target resource for cost allocation string (required)
percentage Percentage of source cost to allocate to this resource. This value can be specified to two decimal places and the total percentage of all resources in this rule must sum to 100.00. int (required)

Terraform (AzAPI provider) resource definition

The costAllocationRules resource type can be deployed to:

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

Resource format

To create a Microsoft.CostManagement/costAllocationRules resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.CostManagement/costAllocationRules@2020-03-01-preview"
  name = "string"
  parent_id = "string"
  body = jsonencode({
    properties = {
      description = "string"
      details = {
        sourceResources = [
          {
            name = "string"
            resourceType = "string"
            values = [
              "string"
            ]
          }
        ]
        targetResources = [
          {
            name = "string"
            policyType = "FixedProportion"
            resourceType = "string"
            values = [
              {
                name = "string"
                percentage = int
              }
            ]
          }
        ]
      }
      status = "string"
    }
  })
}

Property values

costAllocationRules

Name Description Value
type The resource type “Microsoft.CostManagement/costAllocationRules@2020-03-01-preview”
name The resource name string (required)
parent_id string (required)
properties Cost allocation rule properties CostAllocationRuleProperties

CostAllocationRuleProperties

Name Description Value
description Description of a cost allocation rule. string
details Resource information for the cost allocation rule CostAllocationRuleDetails (required)
status Status of the rule “Active”
“NotActive”
“Processing” (required)

CostAllocationRuleDetails

Name Description Value
sourceResources Source resources for cost allocation. At this time, this list can contain no more than one element. SourceCostAllocationResource[]
targetResources Target resources for cost allocation. At this time, this list can contain no more than one element. TargetCostAllocationResource[]

SourceCostAllocationResource

Name Description Value
name If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag string (required)
resourceType Type of resources contained in this cost allocation rule “Dimension”
“Tag” (required)
values Source Resources for cost allocation. This list cannot contain more than 25 values. string[] (required)

TargetCostAllocationResource

Name Description Value
name If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag string (required)
policyType Method of cost allocation for the rule “FixedProportion” (required)
resourceType Type of resources contained in this cost allocation rule “Dimension”
“Tag” (required)
values Target resources for cost allocation. This list cannot contain more than 25 values. CostAllocationProportion[] (required)

CostAllocationProportion

Name Description Value
name Target resource for cost allocation string (required)
percentage Percentage of source cost to allocate to this resource. This value can be specified to two decimal places and the total percentage of all resources in this rule must sum to 100.00. int (required)

Source Article

Next Post

Advertise | FortWayne.com

Mon Sep 26 , 2022
Fort Wayne Newspapers advertising campaigns offer Reach, Value and Flexibility to serve the needs of every business and organization. Your dedicated advertising executive will guide you to create the combination of print, digital and event advertising and marketing to meet your goals. Fort Wayne Newspapers publishes The Journal Gazette, […]
Exit mobile version