Vaults - Check Name Availability

Checks that the vault name is valid and is not already in use.

POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability?api-version=2022-07-01

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

Client Api Version.

Request Body

Name Required Type Description
name True

string

The vault name.

type True

Type

The type of resource, Microsoft.KeyVault/vaults

Responses

Name Type Description
200 OK

CheckNameAvailabilityResult

OK -- Operation to check the vault name availability was successful.

Other Status Codes

CloudError

Error response describing why the operation failed.

Examples

Validate a vault name

Sample Request

POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/checkNameAvailability?api-version=2022-07-01

{
  "name": "sample-vault",
  "type": "Microsoft.KeyVault/vaults"
}

Sample Response

{
  "nameAvailable": true
}

Definitions

Name Description
CheckNameAvailabilityResult

The CheckNameAvailability operation response.

CloudError

An error response from Key Vault resource provider

CloudErrorBody

An error response from Key Vault resource provider

Reason

The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false.

Type

The type of resource, Microsoft.KeyVault/vaults

VaultCheckNameAvailabilityParameters

The parameters used to check the availability of the vault name.

CheckNameAvailabilityResult

The CheckNameAvailability operation response.

Name Type Description
message

string

An error message explaining the Reason value in more detail.

nameAvailable

boolean

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 is invalid and cannot be used.

reason

Reason

The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false.

CloudError

An error response from Key Vault resource provider

Name Type Description
error

CloudErrorBody

An error response from Key Vault resource provider

CloudErrorBody

An error response from Key Vault resource provider

Name Type Description
code

string

Error code. This is a mnemonic that can be consumed programmatically.

message

string

User friendly error message. The message is typically localized and may vary with service version.

Reason

The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false.

Name Type Description
AccountNameInvalid

string

AlreadyExists

string

Type

The type of resource, Microsoft.KeyVault/vaults

Name Type Description
Microsoft.KeyVault/vaults

string

VaultCheckNameAvailabilityParameters

The parameters used to check the availability of the vault name.

Name Type Description
name

string

The vault name.

type

Type

The type of resource, Microsoft.KeyVault/vaults