Cost Allocation Rules - Get
Get a cost allocation rule by rule name and billing account or enterprise enrollment.
GET https://management.azure.com/providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName}?api-version=2025-03-01
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
billing
|
path | True |
string |
BillingAccount ID |
|
rule
|
path | True |
string pattern: [A-Za-z0-9\-_]+ |
Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. |
|
api-version
|
query | True |
string minLength: 1 |
The API version to use for this operation. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
Azure operation completed successfully. |
|
| Other Status Codes |
An unexpected error response. |
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
| Name | Description |
|---|---|
| user_impersonation | impersonate your user account |
Examples
CostAllocationRules
Sample request
GET https://management.azure.com/providers/microsoft.Billing/billingAccounts/100/providers/Microsoft.CostManagement/costAllocationRules/testRule?api-version=2025-03-01
Sample response
{
"name": "testRule",
"type": "Microsoft.CostManagement/costAllocationRules",
"id": "/providers/Microsoft.Billing/billingAccounts/100/providers/Microsoft.CostManagement/costAllocationRules/testRule",
"properties": {
"description": "This is a testRule",
"createdDate": "2020-06-18T22:21:51.1287144Z",
"status": "NotActive",
"updatedDate": "2020-06-18T22:21:51.1287144Z",
"details": {
"sourceResources": [
{
"name": "ResourceGroupName",
"resourceType": "Dimension",
"values": [
"sampleRG"
]
}
],
"targetResources": [
{
"name": "ResourceGroupName",
"policyType": "FixedProportion",
"resourceType": "Dimension",
"values": [
{
"name": "destinationRG",
"percentage": 50
},
{
"name": "destinationRG2",
"percentage": 50
}
]
}
]
}
}
}
Definitions
| Name | Description |
|---|---|
|
Cost |
Method to use for allocating cost. FixedProportion indicates that cost will be split based on specified percentage values. |
|
Cost |
Target resources and allocation |
|
Cost |
Category of resource to use for allocation. |
|
Cost |
The cost allocation rule model definition |
|
Cost |
Resource details of the cost allocation rule |
|
Cost |
The properties of a cost allocation rule |
|
created |
The type of identity that created the resource. |
|
Error |
The details of the error. |
|
Error |
Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. \n\nSome Error responses: \n\n * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header. \n\n * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header. |
|
Rule |
Current status of the rule. |
|
Source |
Source resources for cost allocation |
|
system |
Metadata pertaining to creation and last modification of the resource. |
|
Target |
Target resources for cost allocation. |
CostAllocationPolicyType
Method to use for allocating cost. FixedProportion indicates that cost will be split based on specified percentage values.
| Value | Description |
|---|---|
| FixedProportion |
CostAllocationProportion
Target resources and allocation
| Name | Type | Description |
|---|---|---|
| name |
string |
Target resource for cost allocation |
| percentage |
number (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. |
CostAllocationResourceType
Category of resource to use for allocation.
| Value | Description |
|---|---|
| Dimension |
Indicates an Azure dimension such as a subscription id or resource group name is being used for allocation. |
| Tag |
Allocates cost based on Azure Tag key value pairs. |
CostAllocationRuleDefinition
The cost allocation rule model definition
| Name | Type | Description |
|---|---|---|
| id |
string (arm-id) |
Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" |
| name |
string |
The name of the resource |
| properties |
Cost allocation rule properties |
|
| systemData |
Azure Resource Manager metadata containing createdBy and modifiedBy information. |
|
| type |
string |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" |
CostAllocationRuleDetails
Resource details of the cost allocation rule
| Name | Type | Description |
|---|---|---|
| sourceResources |
Source resources for cost allocation. At this time, this list can contain no more than one element. |
|
| targetResources |
Target resources for cost allocation. At this time, this list can contain no more than one element. |
CostAllocationRuleProperties
The properties of a cost allocation rule
| Name | Type | Description |
|---|---|---|
| createdDate |
string (date-time) |
Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation. |
| description |
string |
Description of a cost allocation rule. |
| details |
Resource information for the cost allocation rule |
|
| status |
Status of the rule |
|
| updatedDate |
string (date-time) |
Time at which the rule was last updated. |
createdByType
The type of identity that created the resource.
| Value | Description |
|---|---|
| User | |
| Application | |
| ManagedIdentity | |
| Key |
ErrorDetails
The details of the error.
| Name | Type | Description |
|---|---|---|
| code |
string |
Error code. |
| message |
string |
Error message indicating why the operation failed. |
ErrorResponse
Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. \n\nSome Error responses: \n\n * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header. \n\n * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header.
| Name | Type | Description |
|---|---|---|
| error |
The details of the error. |
RuleStatus
Current status of the rule.
| Value | Description |
|---|---|
| NotActive |
Rule is saved but not used to allocate costs. |
| Active |
Rule is saved and impacting cost allocation. |
| Processing |
Rule is saved and cost allocation is being updated. Readonly value that cannot be submitted in a put request. |
SourceCostAllocationResource
Source resources for cost allocation
| Name | Type | Description |
|---|---|---|
| name |
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 |
Type of resources contained in this cost allocation rule |
|
| values |
string[] |
Source Resources for cost allocation. This list cannot contain more than 25 values. |
systemData
Metadata pertaining to creation and last modification of the resource.
| Name | Type | Description |
|---|---|---|
| createdAt |
string (date-time) |
The timestamp of resource creation (UTC). |
| createdBy |
string |
The identity that created the resource. |
| createdByType |
The type of identity that created the resource. |
|
| lastModifiedAt |
string (date-time) |
The timestamp of resource last modification (UTC) |
| lastModifiedBy |
string |
The identity that last modified the resource. |
| lastModifiedByType |
The type of identity that last modified the resource. |
TargetCostAllocationResource
Target resources for cost allocation.
| Name | Type | Description |
|---|---|---|
| name |
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 |
Method of cost allocation for the rule |
|
| resourceType |
Type of resources contained in this cost allocation rule |
|
| values |
Target resources for cost allocation. This list cannot contain more than 25 values. |