Share via


Location - Check Name Availability

Checks whether the Batch account name is available in the specified region.

POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability?api-version=2024-07-01

URI Parameters

Name In Required Type Description
locationName
path True

string

The desired region for the name check.

subscriptionId
path True

string

The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)

api-version
query True

string

The API version to be used with the HTTP request.

Request Body

Name Required Type Description
name True

string

The name to check for availability

type True

ResourceType

The resource type.

Responses

Name Type Description
200 OK

CheckNameAvailabilityResult

Success. Returns details about whether a Batch account name is available.

Other Status Codes

CloudError

Error response describing why the operation failed.

Security

azure_auth

Microsoft Entra OAuth 2.0 auth code flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

LocationCheckNameAvailability_AlreadyExists
LocationCheckNameAvailability_Available

LocationCheckNameAvailability_AlreadyExists

Sample request

POST https://management.azure.com/subscriptions/subid/providers/Microsoft.Batch/locations/japaneast/checkNameAvailability?api-version=2024-07-01

{
  "name": "existingaccountname",
  "type": "Microsoft.Batch/batchAccounts"
}

Sample response

{
  "nameAvailable": false,
  "reason": "AlreadyExists",
  "message": "An account named 'existingaccountname' is already in use."
}

LocationCheckNameAvailability_Available

Sample request

POST https://management.azure.com/subscriptions/subid/providers/Microsoft.Batch/locations/japaneast/checkNameAvailability?api-version=2024-07-01

{
  "name": "newaccountname",
  "type": "Microsoft.Batch/batchAccounts"
}

Sample response

{
  "nameAvailable": true
}

Definitions

Name Description
CheckNameAvailabilityParameters

Parameters for a check name availability request.

CheckNameAvailabilityResult

The CheckNameAvailability operation response.

CloudError

An error response from the Batch service.

CloudErrorBody

An error response from the Batch service.

NameAvailabilityReason

Gets the reason that a Batch account name could not be used. The Reason element is only returned if NameAvailable is false.

ResourceType

The resource type.

CheckNameAvailabilityParameters

Parameters for a check name availability request.

Name Type Description
name

string

The name to check for availability

type

ResourceType

The resource type.

CheckNameAvailabilityResult

The CheckNameAvailability operation response.

Name Type Description
message

string

Gets an error message explaining the Reason value in more detail.

nameAvailable

boolean

Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used.

reason

NameAvailabilityReason

Gets the reason that a Batch account name could not be used. The Reason element is only returned if NameAvailable is false.

CloudError

An error response from the Batch service.

Name Type Description
error

CloudErrorBody

The body of the error response.

CloudErrorBody

An error response from the Batch service.

Name Type Description
code

string

An identifier for the error. Codes are invariant and are intended to be consumed programmatically.

details

CloudErrorBody[]

A list of additional details about the error.

message

string

A message describing the error, intended to be suitable for display in a user interface.

target

string

The target of the particular error. For example, the name of the property in error.

NameAvailabilityReason

Gets the reason that a Batch account name could not be used. The Reason element is only returned if NameAvailable is false.

Value Description
Invalid

The requested name is invalid.

AlreadyExists

The requested name is already in use.

ResourceType

The resource type.

Value Description
Microsoft.Batch/batchAccounts

The Batch account resource type.