Servers - Sql

Determines whether a resource can be created with the specified name.

POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability&api-version={api-version}
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability?$expand={$expand}&api-version={api-version}

URI Parameters

Name In Required Type Description
resourceGroupName
path True
  • string
The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
serverName
path True
  • string
The name of the server.
transparentDataEncryptionName
path True
  • string
The name of the transparent data encryption configuration.
subscriptionId
path True
  • string

The subscription ID that identifies an Azure subscription.

$expand
query
  • string
A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption.
api-version
query True
  • string

The API version to use for the request.

Request Body

Name Required Type Description
name True
  • string

The name whose availability is to be checked.

type True
  • enum:
    • Microsoft.Sql/servers

The type of resource that is used as the scope of the availability check.

Responses

Name Type Description
200 OK

OK

Examples

Check for a server name that is available
Check for a server name that already exists
Check for a server name that is invalid

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=2014-04-01
{
  "name": "server1",
  "type": "Microsoft.Sql/servers"
}

Sample Response

{
  "name": "server1",
  "available": true,
  "reason": null,
  "message": null
}

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=2014-04-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 invalid

Sample Request

POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/checkNameAvailability&api-version=2014-04-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 Type Description
available
  • boolean

True if the name is available, otherwise false.

message
  • string

A message explaining why the name is unavailable. Will be null if the name is available.

name
  • string

The name whose availability was checked.

reason
  • enum:
    • Invalid
    • AlreadyExists

The reason code explaining why the name is unavailable. Will be null if the name is available.