cost_allocation_rules
Creates, updates, deletes, gets or lists a cost_allocation_rules
resource.
Overview
Name | cost_allocation_rules |
Type | Resource |
Id | azure.cost_management.cost_allocation_rules |
Fields
The following fields are returned by SELECT
queries:
- get
- list
OK. The request has succeeded.
Name | Datatype | Description |
---|---|---|
id | string | Azure Resource Manager Id for the rule. This is a read ony value. |
name | string | Name of the rule. This is a read only value. |
properties | object | Cost allocation rule properties |
type | string | Resource type of the rule. This is a read only value of Microsoft.CostManagement/CostAllocationRule. |
List of cost allocation rules for the billing account or enterprise enrollment.
Name | Datatype | Description |
---|---|---|
id | string | Azure Resource Manager Id for the rule. This is a read ony value. |
name | string | Name of the rule. This is a read only value. |
properties | object | Cost allocation rule properties |
type | string | Resource type of the rule. This is a read only value of Microsoft.CostManagement/CostAllocationRule. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | billingAccountId , ruleName | Get a cost allocation rule by rule name and billing account or enterprise enrollment. | |
list | select | billingAccountId | Get the list of all cost allocation rules for a billing account or enterprise enrollment. | |
create_or_update | insert | billingAccountId , ruleName | Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. | |
delete | delete | billingAccountId , ruleName | Delete cost allocation rule for billing account or enterprise enrollment. | |
check_name_availability | exec | billingAccountId | Checks availability and correctness of a name for a cost allocation rule |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
billingAccountId | string | BillingAccount ID |
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. |
SELECT
examples
- get
- list
Get a cost allocation rule by rule name and billing account or enterprise enrollment.
SELECT
id,
name,
properties,
type
FROM azure.cost_management.cost_allocation_rules
WHERE billingAccountId = '{{ billingAccountId }}' -- required
AND ruleName = '{{ ruleName }}' -- required
;
Get the list of all cost allocation rules for a billing account or enterprise enrollment.
SELECT
id,
name,
properties,
type
FROM azure.cost_management.cost_allocation_rules
WHERE billingAccountId = '{{ billingAccountId }}' -- required
;
INSERT
examples
- create_or_update
- Manifest
Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment.
INSERT INTO azure.cost_management.cost_allocation_rules (
data__properties,
billingAccountId,
ruleName
)
SELECT
'{{ properties }}',
'{{ billingAccountId }}',
'{{ ruleName }}'
RETURNING
id,
name,
properties,
type
;
# Description fields are for documentation purposes
- name: cost_allocation_rules
props:
- name: billingAccountId
value: string
description: Required parameter for the cost_allocation_rules resource.
- name: ruleName
value: string
description: Required parameter for the cost_allocation_rules resource.
- name: properties
value: object
description: |
Cost allocation rule properties
DELETE
examples
- delete
Delete cost allocation rule for billing account or enterprise enrollment.
DELETE FROM azure.cost_management.cost_allocation_rules
WHERE billingAccountId = '{{ billingAccountId }}' --required
AND ruleName = '{{ ruleName }}' --required
;
Lifecycle Methods
- check_name_availability
Checks availability and correctness of a name for a cost allocation rule
EXEC azure.cost_management.cost_allocation_rules.check_name_availability
@billingAccountId='{{ billingAccountId }}' --required
@@json=
'{
"name": "{{ name }}",
"type": "{{ type }}"
}'
;