Use valid SQL Database names
November 27, 2025 ยท View on GitHub
SYNOPSIS
Azure SQL Database names should meet naming requirements.
DESCRIPTION
When naming Azure resources, resource names must meet service requirements. The requirements for SQL Database names are:
- Between 1 and 128 characters long.
- Letters, numbers, and special characters except:
<>*%&:\/? - Can't end with period or a space.
- Must be unique for each logical server.
The following reserved database names can not be used:
mastermodeltempdb
RECOMMENDATION
Consider using names that meet Azure SQL Database naming requirements. Additionally consider naming resources with a standard naming convention.
EXAMPLES
Configure with Bicep
To deploy databases that pass this rule:
- Set the
nameproperty to a string that matches the naming requirements. - Optionally, consider constraining name parameters with
minLengthandmaxLengthattributes.
For example:
@minLength(1)
@maxLength(128)
@description('The name of the resource.')
param name string
@description('The location resources will be deployed.')
param location string = resourceGroup().location
resource database 'Microsoft.Sql/servers/databases@2024-05-01-preview' = {
parent: server
name: name
location: location
properties: {
collation: 'SQL_Latin1_General_CP1_CI_AS'
maxSizeBytes: maxSize
catalogCollation: 'SQL_Latin1_General_CP1_CI_AS'
readScale: 'Disabled'
zoneRedundant: true
}
}
Configure with Azure template
To deploy databases that pass this rule:
- Set the
nameproperty to a string that matches the naming requirements. - Optionally, consider constraining name parameters with
minLengthandmaxLengthattributes.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"metadata": {
"description": "The name of the resource."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "The location resources will be deployed."
}
}
},
"resources": [
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2024-05-01-preview",
"name": "[format('{0}/{1}', parameters('name'), parameters('name'))]",
"location": "[parameters('location')]",
"properties": {
"collation": "SQL_Latin1_General_CP1_CI_AS",
"maxSizeBytes": "[variables('maxSize')]",
"catalogCollation": "SQL_Latin1_General_CP1_CI_AS",
"readScale": "Disabled",
"zoneRedundant": true
}
}
]
}
NOTES
This rule does not check if Azure SQL Database names are unique.