Check Name Availability - Check Name Availability

Checks the availability and validity of a domain name for the tenant.

POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/checkNameAvailability?api-version=2023-05-17-preview

URI Parameters

Name In Required Type Description
subscriptionId
path True

string

Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

api-version
query True

string

Version of the API to be used with the client request.

Request Body

Name Required Type Description
countryCode True

string

Country code of Azure tenant (e.g. 'US'). Refer to aka.ms/B2CDataResidency to see valid country codes and corresponding data residency locations. If you do not see a country code in an valid data residency location, choose one from the list.

name True

string

The sub domain name to check for availability.

Responses

Name Type Description
200 OK

NameAvailabilityResponse

The result of checking for the name availability.

Other Status Codes

CloudError

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

Check name availability - available
Check name availability - taken

Check name availability - available

Sample request

POST https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.AzureActiveDirectory/checkNameAvailability?api-version=2023-05-17-preview

{
  "name": "constoso",
  "countryCode": "US"
}

Sample response

{
  "nameAvailable": true,
  "reason": null,
  "message": null
}

Check name availability - taken

Sample request

POST https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.AzureActiveDirectory/checkNameAvailability?api-version=2023-05-17-preview

{
  "name": "constoso",
  "countryCode": "US"
}

Sample response

{
  "nameAvailable": false,
  "reason": "AlreadyExists",
  "message": "A tenant with this sub domain name already exists. Please choose another."
}

Definitions

Name Description
CheckNameAvailabilityRequestBody

The information required to check the availability of the sub domain name for the tenant.

CloudError

An error response for a resource management request.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

NameAvailabilityReasonType

Describes the reason for the 'nameAvailable' value.

NameAvailabilityResponse

Response of the CheckNameAvailability operation.

CheckNameAvailabilityRequestBody

The information required to check the availability of the sub domain name for the tenant.

Name Type Description
countryCode

string

Country code of Azure tenant (e.g. 'US'). Refer to aka.ms/B2CDataResidency to see valid country codes and corresponding data residency locations. If you do not see a country code in an valid data residency location, choose one from the list.

name

string

The sub domain name to check for availability.

CloudError

An error response for a resource management request.

Name Type Description
error

ErrorResponse

Error response
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response

Name Type Description
error

ErrorDetail

The error object.

NameAvailabilityReasonType

Describes the reason for the 'nameAvailable' value.

Name Type Description
AlreadyExists

string

The name is already in use and is therefore unavailable.

Invalid

string

The name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.).

NameAvailabilityResponse

Response of the CheckNameAvailability operation.

Name Type Description
message

string

Description of the reason if name is not available.

nameAvailable

boolean

True if the name is available and can be used to create a new tenant. Otherwise false.

reason

NameAvailabilityReasonType

Describes the reason for the 'nameAvailable' value.