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
- vw_cost_allocation_rules
- cost_allocation_rules
Name | Datatype | Description |
---|---|---|
id | text | Azure Resource Manager Id for the rule. This is a read ony value. |
name | text | Name of the rule. This is a read only value. |
description | text | field from the properties object |
billingAccountId | text | field from the properties object |
created_date | text | field from the properties object |
details | text | field from the properties object |
ruleName | text | field from the properties object |
status | text | field from the properties object |
type | text | Resource type of the rule. This is a read only value of Microsoft.CostManagement/CostAllocationRule. |
updated_date | text | field from the properties object |
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 | The properties of a cost allocation rule |
type | string | Resource type of the rule. This is a read only value of Microsoft.CostManagement/CostAllocationRule. |
Methods
Name | Accessible by | Required 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 |
SELECT
examples
Get the list of all cost allocation rules for a billing account or enterprise enrollment.
- vw_cost_allocation_rules
- cost_allocation_rules
SELECT
id,
name,
description,
billingAccountId,
created_date,
details,
ruleName,
status,
type,
updated_date
FROM azure.cost_management.vw_cost_allocation_rules
WHERE billingAccountId = '{{ billingAccountId }}';
SELECT
id,
name,
properties,
type
FROM azure.cost_management.cost_allocation_rules
WHERE billingAccountId = '{{ billingAccountId }}';
INSERT
example
Use the following StackQL query and manifest file to create a new cost_allocation_rules
resource.
- All Properties
- Manifest
/*+ create */
INSERT INTO azure.cost_management.cost_allocation_rules (
billingAccountId,
ruleName,
properties
)
SELECT
'{{ billingAccountId }}',
'{{ ruleName }}',
'{{ properties }}'
;
- name: your_resource_model_name
props:
- name: id
value: string
- name: name
value: string
- name: type
value: string
- name: properties
value:
- name: description
value: string
- name: details
value:
- name: sourceResources
value:
- - name: resourceType
value: []
- name: name
value: string
- name: targetResources
value:
- - name: name
value: string
- name: status
value: []
- name: createdDate
value: string
- name: updatedDate
value: string
DELETE
example
Deletes the specified cost_allocation_rules
resource.
/*+ delete */
DELETE FROM azure.cost_management.cost_allocation_rules
WHERE billingAccountId = '{{ billingAccountId }}'
AND ruleName = '{{ ruleName }}';