Azure SQL database naming convention
The CAF abbreviation for Azure SQL database is sqldb.
Names can be 1 to 128 characters long and allow alphanumerics, hyphens and underscores.
The name must be unique within the parent resource.
Naming rules
| CAF abbreviation | sqldb |
|---|---|
| Length | 1 to 128 characters |
| Allowed characters | Alphanumerics (a-z, A-Z, 0-9), hyphens, underscores |
| Scope of uniqueness | Unique within the parent resource |
| CAF pattern | sqldb-{workload}-{environment}-{region}-{instance} |
Rules follow Microsoft's resource naming rules and CAF abbreviations. Some resource types have extra start/end character restrictions, so verify against the official docs before locking in a convention.
Naming Databases resources
Databases have the clearest two layer split of any category. Cosmos DB (every API variant) and Azure SQL Database servers are globally unique DNS endpoints, with the actual databases and containers inside them scoped and relaxed, covered in detail in the Cosmos DB and SQL guides. MySQL and PostgreSQL flexible servers follow the identical pattern, they get a public DNS endpoint too, which is easy to forget since a MySQL server does not feel like an internet facing resource the way a storage account does.
SQL Managed Instance breaks the pattern, it is VNet injected and not globally unique the same way a logical SQL server is. The common mistake is assuming every database engine has the same globally unique server tier by default, when the rule genuinely varies by resource type, worth checking the specific rule rather than reusing an assumption from a different database service.
Example names
Generated by the same engine as the name generator, so length and character rules are already applied.
| Scenario | Generated name | Length |
|---|---|---|
| Payments API, production | sqldb-payments-prod-eus-001 | 27/128 |
| Web app, development | sqldb-webapp-dev-weu-002 | 24/128 |
| Analytics with company prefix | sqldb-contoso-analytics-stage-uks-001 | 37/128 |
Naming in Terraform and Bicep
Build the name from variables so one module produces the right name in every environment.
locals {
sql_database_name = "sqldb-${var.workload}-${var.environment}-${var.region}-001"
} var sqlDatabaseName = 'sqldb-${workload}-${environment}-${region}-001' Generate Azure SQL database names for your workload
Free, no login. Validation and Terraform, Bicep, or CSV export included.
Open in the generator →Related Databases resources
See the full list of Azure resource naming rules or read the complete CAF naming guide.