Cost Allocation Rules - Check Name Availability
Checks availability and correctness of a name for a cost allocation rule
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/checkNameAvailability?api-version=2025-03-01
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
billing
|
path | True |
string |
BillingAccount ID |
|
api-version
|
query | True |
string minLength: 1 |
The API version to use for this operation. |
Request Body
| Name | Type | Description |
|---|---|---|
| name |
string |
Rule name |
| type |
string |
Resource type. This is expected to be Microsoft.CostManagement/costAllocationRules |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
Response of cost allocation rule name availability. |
|
| Other Status Codes |
Error response describing why the operation failed |
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
CostAllocationRuleCheckNameAvailability
Sample request
POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/100/providers/Microsoft.CostManagement/costAllocationRules/checkNameAvailability?api-version=2025-03-01
{
"name": "testRule",
"type": "Microsoft.CostManagement/costAllocationRules"
}
Sample response
{
"nameAvailable": false,
"reason": "AlreadyExists",
"message": "A cost allocation rule with name testRule is already present for the billing account 100. Please specify a differnt name."
}
Definitions
| Name | Description |
|---|---|
|
Cost |
The cost allocation rule check name availability request |
|
Cost |
The cost allocation rule check name availability response |
|
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. Some Error responses:
|
| Reason |
The reason this name is not available. |
CostAllocationRuleCheckNameAvailabilityRequest
The cost allocation rule check name availability request
| Name | Type | Description |
|---|---|---|
| name |
string |
Rule name |
| type |
string |
Resource type. This is expected to be Microsoft.CostManagement/costAllocationRules |
CostAllocationRuleCheckNameAvailabilityResponse
The cost allocation rule check name availability response
| Name | Type | Description |
|---|---|---|
| message |
string |
Error message if the name is not available |
| nameAvailable |
boolean |
Whether this rule name is available |
| reason |
The reason this name is not available |
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.
Some Error responses:
429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header.
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. |
Reason
The reason this name is not available.
| Value | Description |
|---|---|
| Invalid | |
| AlreadyExists | |
| Valid |