1. Packages
  2. Azure Native
  3. API Docs
  4. costmanagement
  5. getCostAllocationRule
This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.1.0 published on Tuesday, Apr 8, 2025 by Pulumi

azure-native.costmanagement.getCostAllocationRule

Explore with Pulumi AI

This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.1.0 published on Tuesday, Apr 8, 2025 by Pulumi

Get a cost allocation rule by rule name and billing account or enterprise enrollment.

Uses Azure REST API version 2024-08-01.

Other available API versions: 2020-03-01-preview, 2023-08-01, 2023-09-01, 2023-11-01, 2024-10-01-preview. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native costmanagement [ApiVersion]. See the version guide for details.

Using getCostAllocationRule

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getCostAllocationRule(args: GetCostAllocationRuleArgs, opts?: InvokeOptions): Promise<GetCostAllocationRuleResult>
function getCostAllocationRuleOutput(args: GetCostAllocationRuleOutputArgs, opts?: InvokeOptions): Output<GetCostAllocationRuleResult>
Copy
def get_cost_allocation_rule(billing_account_id: Optional[str] = None,
                             rule_name: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetCostAllocationRuleResult
def get_cost_allocation_rule_output(billing_account_id: Optional[pulumi.Input[str]] = None,
                             rule_name: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetCostAllocationRuleResult]
Copy
func LookupCostAllocationRule(ctx *Context, args *LookupCostAllocationRuleArgs, opts ...InvokeOption) (*LookupCostAllocationRuleResult, error)
func LookupCostAllocationRuleOutput(ctx *Context, args *LookupCostAllocationRuleOutputArgs, opts ...InvokeOption) LookupCostAllocationRuleResultOutput
Copy

> Note: This function is named LookupCostAllocationRule in the Go SDK.

public static class GetCostAllocationRule 
{
    public static Task<GetCostAllocationRuleResult> InvokeAsync(GetCostAllocationRuleArgs args, InvokeOptions? opts = null)
    public static Output<GetCostAllocationRuleResult> Invoke(GetCostAllocationRuleInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetCostAllocationRuleResult> getCostAllocationRule(GetCostAllocationRuleArgs args, InvokeOptions options)
public static Output<GetCostAllocationRuleResult> getCostAllocationRule(GetCostAllocationRuleArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure-native:costmanagement:getCostAllocationRule
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

BillingAccountId
This property is required.
Changes to this property will trigger replacement.
string
BillingAccount ID
RuleName
This property is required.
Changes to this property will trigger replacement.
string
Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters.
BillingAccountId
This property is required.
Changes to this property will trigger replacement.
string
BillingAccount ID
RuleName
This property is required.
Changes to this property will trigger replacement.
string
Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters.
billingAccountId
This property is required.
Changes to this property will trigger replacement.
String
BillingAccount ID
ruleName
This property is required.
Changes to this property will trigger replacement.
String
Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters.
billingAccountId
This property is required.
Changes to this property will trigger replacement.
string
BillingAccount ID
ruleName
This property is required.
Changes to this property will trigger replacement.
string
Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters.
billing_account_id
This property is required.
Changes to this property will trigger replacement.
str
BillingAccount ID
rule_name
This property is required.
Changes to this property will trigger replacement.
str
Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters.
billingAccountId
This property is required.
Changes to this property will trigger replacement.
String
BillingAccount ID
ruleName
This property is required.
Changes to this property will trigger replacement.
String
Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters.

getCostAllocationRule Result

The following output properties are available:

AzureApiVersion string
The Azure API version of the resource.
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 Pulumi.AzureNative.CostManagement.Outputs.CostAllocationRulePropertiesResponse
Cost allocation rule properties
Type string
Resource type of the rule. This is a read only value of Microsoft.CostManagement/CostAllocationRule.
AzureApiVersion string
The Azure API version of the resource.
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 CostAllocationRulePropertiesResponse
Cost allocation rule properties
Type string
Resource type of the rule. This is a read only value of Microsoft.CostManagement/CostAllocationRule.
azureApiVersion String
The Azure API version of the resource.
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 CostAllocationRulePropertiesResponse
Cost allocation rule properties
type String
Resource type of the rule. This is a read only value of Microsoft.CostManagement/CostAllocationRule.
azureApiVersion string
The Azure API version of the resource.
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 CostAllocationRulePropertiesResponse
Cost allocation rule properties
type string
Resource type of the rule. This is a read only value of Microsoft.CostManagement/CostAllocationRule.
azure_api_version str
The Azure API version of the resource.
id str
Azure Resource Manager Id for the rule. This is a read ony value.
name str
Name of the rule. This is a read only value.
properties CostAllocationRulePropertiesResponse
Cost allocation rule properties
type str
Resource type of the rule. This is a read only value of Microsoft.CostManagement/CostAllocationRule.
azureApiVersion String
The Azure API version of the resource.
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 Property Map
Cost allocation rule properties
type String
Resource type of the rule. This is a read only value of Microsoft.CostManagement/CostAllocationRule.

Supporting Types

CostAllocationProportionResponse

Name This property is required. string
Target resource for cost allocation
Percentage This property is required. double
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.
Name This property is required. string
Target resource for cost allocation
Percentage This property is required. float64
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.
name This property is required. String
Target resource for cost allocation
percentage This property is required. Double
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.
name This property is required. string
Target resource for cost allocation
percentage This property is required. number
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.
name This property is required. str
Target resource for cost allocation
percentage This property is required. float
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.
name This property is required. String
Target resource for cost allocation
percentage This property is required. Number
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.

CostAllocationRuleDetailsResponse

SourceResources List<Pulumi.AzureNative.CostManagement.Inputs.SourceCostAllocationResourceResponse>
Source resources for cost allocation. At this time, this list can contain no more than one element.
TargetResources List<Pulumi.AzureNative.CostManagement.Inputs.TargetCostAllocationResourceResponse>
Target resources for cost allocation. At this time, this list can contain no more than one element.
SourceResources []SourceCostAllocationResourceResponse
Source resources for cost allocation. At this time, this list can contain no more than one element.
TargetResources []TargetCostAllocationResourceResponse
Target resources for cost allocation. At this time, this list can contain no more than one element.
sourceResources List<SourceCostAllocationResourceResponse>
Source resources for cost allocation. At this time, this list can contain no more than one element.
targetResources List<TargetCostAllocationResourceResponse>
Target resources for cost allocation. At this time, this list can contain no more than one element.
sourceResources SourceCostAllocationResourceResponse[]
Source resources for cost allocation. At this time, this list can contain no more than one element.
targetResources TargetCostAllocationResourceResponse[]
Target resources for cost allocation. At this time, this list can contain no more than one element.
source_resources Sequence[SourceCostAllocationResourceResponse]
Source resources for cost allocation. At this time, this list can contain no more than one element.
target_resources Sequence[TargetCostAllocationResourceResponse]
Target resources for cost allocation. At this time, this list can contain no more than one element.
sourceResources List<Property Map>
Source resources for cost allocation. At this time, this list can contain no more than one element.
targetResources List<Property Map>
Target resources for cost allocation. At this time, this list can contain no more than one element.

CostAllocationRulePropertiesResponse

CreatedDate This property is required. string
Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation.
Details This property is required. Pulumi.AzureNative.CostManagement.Inputs.CostAllocationRuleDetailsResponse
Resource information for the cost allocation rule
Status This property is required. string
Status of the rule
UpdatedDate This property is required. string
Time at which the rule was last updated.
Description string
Description of a cost allocation rule.
CreatedDate This property is required. string
Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation.
Details This property is required. CostAllocationRuleDetailsResponse
Resource information for the cost allocation rule
Status This property is required. string
Status of the rule
UpdatedDate This property is required. string
Time at which the rule was last updated.
Description string
Description of a cost allocation rule.
createdDate This property is required. String
Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation.
details This property is required. CostAllocationRuleDetailsResponse
Resource information for the cost allocation rule
status This property is required. String
Status of the rule
updatedDate This property is required. String
Time at which the rule was last updated.
description String
Description of a cost allocation rule.
createdDate This property is required. string
Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation.
details This property is required. CostAllocationRuleDetailsResponse
Resource information for the cost allocation rule
status This property is required. string
Status of the rule
updatedDate This property is required. string
Time at which the rule was last updated.
description string
Description of a cost allocation rule.
created_date This property is required. str
Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation.
details This property is required. CostAllocationRuleDetailsResponse
Resource information for the cost allocation rule
status This property is required. str
Status of the rule
updated_date This property is required. str
Time at which the rule was last updated.
description str
Description of a cost allocation rule.
createdDate This property is required. String
Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation.
details This property is required. Property Map
Resource information for the cost allocation rule
status This property is required. String
Status of the rule
updatedDate This property is required. String
Time at which the rule was last updated.
description String
Description of a cost allocation rule.

SourceCostAllocationResourceResponse

Name This property is required. string
If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag
ResourceType This property is required. string
Type of resources contained in this cost allocation rule
Values This property is required. List<string>
Source Resources for cost allocation. This list cannot contain more than 25 values.
Name This property is required. string
If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag
ResourceType This property is required. string
Type of resources contained in this cost allocation rule
Values This property is required. []string
Source Resources for cost allocation. This list cannot contain more than 25 values.
name This property is required. String
If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag
resourceType This property is required. String
Type of resources contained in this cost allocation rule
values This property is required. List<String>
Source Resources for cost allocation. This list cannot contain more than 25 values.
name This property is required. string
If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag
resourceType This property is required. string
Type of resources contained in this cost allocation rule
values This property is required. string[]
Source Resources for cost allocation. This list cannot contain more than 25 values.
name This property is required. str
If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag
resource_type This property is required. str
Type of resources contained in this cost allocation rule
values This property is required. Sequence[str]
Source Resources for cost allocation. This list cannot contain more than 25 values.
name This property is required. String
If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag
resourceType This property is required. String
Type of resources contained in this cost allocation rule
values This property is required. List<String>
Source Resources for cost allocation. This list cannot contain more than 25 values.

TargetCostAllocationResourceResponse

Name This property is required. string
If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag
PolicyType This property is required. string
Method of cost allocation for the rule
ResourceType This property is required. string
Type of resources contained in this cost allocation rule
Values This property is required. List<Pulumi.AzureNative.CostManagement.Inputs.CostAllocationProportionResponse>
Target resources for cost allocation. This list cannot contain more than 25 values.
Name This property is required. string
If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag
PolicyType This property is required. string
Method of cost allocation for the rule
ResourceType This property is required. string
Type of resources contained in this cost allocation rule
Values This property is required. []CostAllocationProportionResponse
Target resources for cost allocation. This list cannot contain more than 25 values.
name This property is required. String
If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag
policyType This property is required. String
Method of cost allocation for the rule
resourceType This property is required. String
Type of resources contained in this cost allocation rule
values This property is required. List<CostAllocationProportionResponse>
Target resources for cost allocation. This list cannot contain more than 25 values.
name This property is required. string
If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag
policyType This property is required. string
Method of cost allocation for the rule
resourceType This property is required. string
Type of resources contained in this cost allocation rule
values This property is required. CostAllocationProportionResponse[]
Target resources for cost allocation. This list cannot contain more than 25 values.
name This property is required. str
If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag
policy_type This property is required. str
Method of cost allocation for the rule
resource_type This property is required. str
Type of resources contained in this cost allocation rule
values This property is required. Sequence[CostAllocationProportionResponse]
Target resources for cost allocation. This list cannot contain more than 25 values.
name This property is required. String
If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag
policyType This property is required. String
Method of cost allocation for the rule
resourceType This property is required. String
Type of resources contained in this cost allocation rule
values This property is required. List<Property Map>
Target resources for cost allocation. This list cannot contain more than 25 values.

Package Details

Repository
Azure Native pulumi/pulumi-azure-native
License
Apache-2.0
This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.1.0 published on Tuesday, Apr 8, 2025 by Pulumi