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=2023-11-01

URI Parameters

Name In Required Type Description
billingAccountId
path True

string

BillingAccount ID

api-version
query True

string

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

CostAllocationRuleCheckNameAvailabilityResponse

Response of cost allocation rule name availability.

Other Status Codes

ErrorResponse

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=2023-11-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
CostAllocationRuleCheckNameAvailabilityRequest

The cost allocation rule check name availability request

CostAllocationRuleCheckNameAvailabilityResponse

The cost allocation rule check name availability response

ErrorDetails

The details of the error.

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.

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

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

ErrorDetails

The details of the error.

Reason

The reason this name is not available.

Name Type Description
AlreadyExists

string

Invalid

string

Valid

string