Servers - Check Name Availability
Determines whether a resource can be created with the specified name.
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability?api-version=2023-08-01
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
subscription
|
path | True |
string |
The subscription ID that identifies an Azure subscription. |
api-version
|
query | True |
string |
The API version to use for the request. |
Request Body
Name | Required | Type | Description |
---|---|---|---|
name | True |
string |
|
type | True |
Responses
Name | Type | Description |
---|---|---|
200 OK |
Successfully completed the availability check. |
|
Other Status Codes |
*** Error Responses: ***
|
Examples
Check for a server name that already exists |
Check for a server name that is available |
Check for a server name that is invalid |
Check for a server name that already exists
Sample request
POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/checkNameAvailability?api-version=2023-08-01
{
"name": "server1",
"type": "Microsoft.Sql/servers"
}
Sample response
{
"name": "server1",
"available": false,
"reason": "AlreadyExists",
"message": "Specified server name is already used"
}
Check for a server name that is available
Sample request
POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/checkNameAvailability?api-version=2023-08-01
{
"name": "server1",
"type": "Microsoft.Sql/servers"
}
Sample response
{
"name": "server1",
"available": true
}
Check for a server name that is invalid
Sample request
POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/checkNameAvailability?api-version=2023-08-01
{
"name": "SERVER1",
"type": "Microsoft.Sql/servers"
}
Sample response
{
"name": "SERVER1",
"available": false,
"reason": "Invalid",
"message": "Specified server name contains unsupported characters or is too long. Server name must be no longer than 63 characters long, contain only lower-case characters or digits, cannot contain '.' or '_' characters and can't start or end with '-' character."
}
Definitions
Name | Description |
---|---|
Check |
The reason code explaining why the name is unavailable. Will be undefined if the name is available. |
Check |
A request to check whether the specified name for a resource is available. |
Check |
|
Check |
The result of a name availability check. |
Error |
The resource management error additional info. |
Error |
The error detail. |
Error |
Error response |
CheckNameAvailabilityReason
The reason code explaining why the name is unavailable. Will be undefined if the name is available.
Value | Description |
---|---|
AlreadyExists | |
Invalid |
CheckNameAvailabilityRequest
A request to check whether the specified name for a resource is available.
Name | Type | Description |
---|---|---|
name |
string |
|
type |
CheckNameAvailabilityResourceType
Value | Description |
---|---|
Microsoft.Sql/servers |
CheckNameAvailabilityResponse
The result of a name availability check.
Name | Type | Description |
---|---|---|
available |
boolean |
True if the name is available, otherwise false. |
message |
string |
A message explaining why the name is unavailable. Will be undefined if the name is available. |
name |
string |
The name whose availability was checked. |
reason |
The reason code explaining why the name is unavailable. Will be undefined if the name is available. |
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 |
The error additional info. |
|
code |
string |
The error code. |
details |
The error details. |
|
message |
string |
The error message. |
target |
string |
The error target. |
ErrorResponse
Error response
Name | Type | Description |
---|---|---|
error |
The error object. |