Naming Strategies - Azure/az-prototype GitHub Wiki
Naming Strategies
Overview
az prototype enforces consistent Azure resource naming across all generated infrastructure code (Terraform and Bicep). The naming module provides five built-in strategies that agents use when generating resource definitions. Every resource name is run through constraint checks for Azure-specific length limits and character restrictions.
The naming strategy is configured in the naming section of prototype.yaml. See Configuration for the full config structure.
Strategies
1. microsoft-alz -- Azure Landing Zone (Default)
Based on the Microsoft Azure Landing Zone naming conventions. Uses a zone ID prefix that identifies the landing zone purpose.
Pattern: {zoneid}-{type}-{service}-{env}-{region_short}
Examples (zone=zd, org=contoso, env=dev, region=eastus):
| Resource Type | Generated Name |
|---|---|
| resource_group | zd-rg-api-dev-eus |
| storage_account | zdstapidevseus |
| app_service | zd-app-api-dev-eus |
| key_vault | zd-kv-api-dev-eus |
| cosmos_db | zd-cosmos-api-dev-eus |
Platform resources (networking, identity, monitoring) use pc, pi, or pm zone IDs. Application resources use zd, zt, zs, or zp based on environment.
2. microsoft-caf -- Cloud Adoption Framework
Follows the Microsoft Cloud Adoption Framework resource naming best practices. Includes organization name and instance number.
Pattern: {type}-{org}-{service}-{env}-{region_short}-{instance}
Examples (org=contoso, env=dev, region=eastus, instance=001):
| Resource Type | Generated Name |
|---|---|
| resource_group | rg-contoso-api-dev-eus-001 |
| storage_account | stcontosoapideveus001 |
| app_service | app-contoso-api-dev-eus-001 |
| key_vault | kv-contoso-api-dev-eus-001 |
| cosmos_db | cosmos-contoso-api-dev-eus-001 |
Reference: Azure resource naming conventions
3. simple -- Basic Naming
Minimal naming for quick prototypes. No region or instance suffix.
Pattern: {org}-{service}-{type}-{env}
Examples (org=contoso, env=dev):
| Resource Type | Generated Name |
|---|---|
| resource_group | contoso-api-rg-dev |
| storage_account | contosoapistdev |
| app_service | contoso-api-app-dev |
| key_vault | contoso-api-kv-dev |
| cosmos_db | contoso-api-cosmos-dev |
4. enterprise -- Enterprise Naming
Includes a business unit prefix for organizations with multiple teams sharing an Azure environment.
Pattern: {type}-{bu}-{org}-{service}-{env}-{region_short}-{instance}
Examples (bu=it, org=contoso, env=dev, region=eastus, instance=001):
| Resource Type | Generated Name |
|---|---|
| resource_group | rg-it-contoso-api-dev-eus-001 |
| storage_account | rgitcontosoapideveus001 |
| app_service | app-it-contoso-api-dev-eus-001 |
| key_vault | kv-it-contoso-api-dev-eus-001 |
| cosmos_db | cosmos-it-contoso-api-dev-eus-001 |
The business unit is configured via naming.business_unit (defaults to eng).
5. custom -- Custom Pattern
Define your own naming pattern using placeholders. The pattern is read from naming.pattern in the config.
Default pattern: {type}-{org}-{service}-{env}-{region_short}
Available placeholders:
| Placeholder | Description |
|---|---|
{org} |
Organization name (from naming.org or project.name) |
{env} |
Environment abbreviation |
{region} |
Full Azure region name (e.g., eastus) |
{region_short} |
Short region code (e.g., eus) |
{service} |
Service/component name (e.g., api, web); defaults to core |
{type} |
CAF resource type abbreviation (e.g., rg, st, kv) |
{suffix} |
Optional suffix (from naming.suffix) |
{instance} |
Instance number (from naming.instance, defaults to 001) |
{zoneid} |
ALZ zone ID (from naming.zone_id or derived from environment) |
Example custom pattern:
az prototype config set --key naming.strategy --value custom
az prototype config set --key naming.pattern --value "{org}-{type}-{service}-{env}-{region_short}"
Zone IDs and Region Codes
ALZ Zone IDs
Zone IDs identify the purpose of a landing zone in the Azure Landing Zone architecture:
| Zone ID | Landing Zone |
|---|---|
pc |
Connectivity Platform |
pi |
Identity Platform |
pm |
Management Platform |
zp |
Production Zone |
zs |
Staging Zone |
zd |
Development Zone (default) |
zt |
Testing Zone |
The zone ID is resolved from naming.zone_id in config. If not set explicitly, it is derived from the environment name:
| Environment | Zone ID |
|---|---|
dev, development |
zd |
test, testing, qa |
zt |
staging, stg, uat |
zs |
prod, production |
zp |
Region Short Codes
Azure regions are mapped to short codes for use in resource names:
| Region | Code | Region | Code | |
|---|---|---|---|---|
eastus |
eus |
northeurope |
neu |
|
eastus2 |
eus2 |
westeurope |
weu |
|
westus |
wus |
uksouth |
uks |
|
westus2 |
wus2 |
ukwest |
ukw |
|
westus3 |
wus3 |
francecentral |
frc |
|
centralus |
cus |
germanywestcentral |
gwc |
|
northcentralus |
ncus |
norwayeast |
noe |
|
southcentralus |
scus |
swedencentral |
sec |
|
westcentralus |
wcus |
switzerlandnorth |
szn |
|
canadacentral |
cac |
australiaeast |
aue |
|
canadaeast |
cae |
australiasoutheast |
ause |
|
brazilsouth |
brs |
eastasia |
ea |
|
southeastasia |
sea |
japaneast |
jpe |
|
japanwest |
jpw |
koreacentral |
krc |
|
koreasouth |
krs |
centralindia |
inc |
|
southindia |
ins |
westindia |
inw |
|
southafricanorth |
san |
uaenorth |
uan |
For regions not in this table, the first four characters of the region name are used as the short code.
CAF Abbreviations
Resource type abbreviations follow the Microsoft Cloud Adoption Framework:
| Resource Type | Abbreviation | Resource Type | Abbreviation | |
|---|---|---|---|---|
resource_group |
rg |
container_app |
ca |
|
storage_account |
st |
container_app_environment |
cae |
|
app_service |
app |
container_registry |
cr |
|
app_service_plan |
asp |
log_analytics |
log |
|
function_app |
func |
application_insights |
appi |
|
key_vault |
kv |
api_management |
apim |
|
cosmos_db |
cosmos |
service_bus |
sb |
|
sql_server |
sql |
event_hub |
evh |
|
sql_database |
sqldb |
event_grid |
evg |
|
virtual_network |
vnet |
front_door |
fd |
|
subnet |
snet |
cdn_profile |
cdnp |
|
network_security_group |
nsg |
dns_zone |
dns |
|
public_ip |
pip |
private_endpoint |
pe |
|
load_balancer |
lb |
managed_identity |
id |
|
redis_cache |
redis |
search_service |
srch |
|
cognitive_account |
cog |
openai_account |
oai |
|
signalr |
sigr |
static_web_app |
stapp |
|
web_pubsub |
wps |
data_factory |
adf |
|
databricks |
dbw |
machine_learning |
mlw |
|
monitor_action_group |
ag |
monitor_alert |
al |
Reference: Azure resource abbreviations
Configuration
Set the naming strategy and related parameters:
# Choose a strategy
az prototype config set --key naming.strategy --value microsoft-caf
# Set organization name (used in resource names)
az prototype config set --key naming.org --value contoso
# Set environment
az prototype config set --key naming.env --value prod
# Set ALZ zone ID (for microsoft-alz strategy)
az prototype config set --key naming.zone_id --value zp
# Set business unit (for enterprise strategy)
az prototype config set --key naming.business_unit --value platform
# Set instance number (for CAF and enterprise strategies)
az prototype config set --key naming.instance --value 002
# Set custom pattern (for custom strategy)
az prototype config set --key naming.strategy --value custom
az prototype config set --key naming.pattern --value "{org}-{type}-{service}-{env}"
# Override a specific resource type
az prototype config set --key naming.overrides.storage_account --value "st{org}{service}{env}"
Azure Naming Constraints
The naming module enforces Azure-specific constraints automatically. After building a name from the strategy pattern, the following rules are applied:
| Resource Type | Max Length | Hyphens Allowed | Lowercase Only |
|---|---|---|---|
storage_account |
24 | No | Yes |
key_vault |
24 | Yes | No |
container_registry |
50 | No | Yes |
resource_group |
90 | Yes | No |
cosmos_db |
44 | Yes | Yes |
| All others | 63 | Yes | No |
Additionally, all non-alphanumeric characters (except hyphens where allowed) are stripped from generated names. Names exceeding the maximum length are truncated.
Per-resource overrides (via naming.overrides) are supported and processed through the same constraint pipeline, so even custom names conform to Azure limits.