In any organisation it is important to get a standard naming convention in place for most things, but especially with cloud based resources.
As many types of cloud resources require globally unique names (due to platform DNS resolution), it’s important to have a strategy that will give you a good chance of achieving global uniqueness, but also as helpful as possible to human beings, as well as codefiable in DevOps CD pipelines.
The easiest thing would be to have some horrendous code or GUID that is either pretty unreadable and/or requires copious looking up of codes in code tables to decipher what and where the resource is.
After years of using Azure, I thought I would share my preferred naming convention. I believe it to be pretty intuitive, human readable and provides a good level of information and … a reasonable chance of, first attempt anyway, of global uniqueness.
The Convention
$ShortOrganisationCode-$ProductCode-$ResourceTypeCode-[$InstanceNo-]$EnvironmentCode-$RegionCode
or without hyphens
$ShortOrganisationCode$ProductCode$ResourceTypeCode[$InstanceNo]$EnvironmentCode$RegionCode
The order and number of elements is not accidental. It will become clear when you have multiple environments in multiple regions!
The ‘codes’ should be kept as small as possible. Somewhere between 3 and 8 characters ideally.
See the examples below.
The Elements
Name Part | Description |
short organisation code | This is your identifiable organisation name short-code. Don’t make it too generic a word, but this will be key to maximising you names global uniqueness. It is also really useful if you support multiple divisions or organisations to easily differentiate between them. For Example: McDonalds might use ‘mcd’ or ‘mcdon’ Microsoft might use ‘ms’ Oracle might use ‘orcl’ |
product short code | This is the project, product or platform identifier. This needs to be unique in your organisation. hint: removing all vowels from a name can be a way to create a good code |
resource type code | This is a code that represents the Azure (or other cloud providers) resource type. See the list below. |
instance no | [Optional] This is only required when you will be instantiating mutiples of the same resource. E.g. multiple VM’s in a cluster |
environment code | This refers to the deployment environments. Such as Development, Test or Production. Recommended codes are: dev test sit int prod |
region code | This refers to the regional data centre that the resource is deployed to. see the list below for Azure |
Key Principles
- All names should be lowercase or Pascal Case (Camel Case with the first character uppercase) if allowed
- Use and update the tables below for short-codes
- Use hyphens when possible
- If no environment is specified in the name, then Production is assumed
- try and keep the name length concise
- Do not use any non URL safe charters anywhere
- Do NOT use any special characters at the start or end of the name
- If you name turns out to not be unique then alter the ‘Product Code’ to be more unusual.
Examples
For a one of my test apps I may have an Application Service, A SQL Azure database and a Storage account all in a Resource Group. Development in North Europe and Production in West Europe. The naming would be as follows:
- nerr-testapp-rg-dev-ne
- nerr-testapp-as-dev-ne
- nerr-testapp-sql-dev-ne
- nerr-testapp-strg-dev-ne
- ner-testapp-rg-prod-we
- nerr-testapp-as-prod-we
- nerr-testapp-sql-prod-we
- nerr-testapp-strg-prod-we
Resource Type Codes (Azure)
This is not a comprehensive list, but should give you the idea. If you want to contribute here, please send me your codes 😉
Resource | Code | Hyphens Allowed |
Resource Group | rg | yes |
Application Service | as | yes |
Container Registry | cr | no |
Storage Account | strg | no |
Data Factory | df | yes |
Function App | func | yes |
Azure SQL Server | sql | yes |
Virtual Machine | vm | yes |
Virtual Network | vnet | yes |
Search Service | srch | yes |
Web App Service | wa | yes |
API App Service | api | yes |
Data Lake Store | dsl | no |
Network Security Group | nsg | yes |
Public IP Address | pip | yes |
Load Balancer | lb | yes |
Availability Set | la | yes |
Recovery Services Vault | vlt | yes |
Key Vault | kv | yes |
DevTest Lab | lab | yes |
Application Service Plan | asp | yes |
Kubernetes Service | aks | yes |
Local Network Gateway | lng | yes |
Virtual Network Gateway | vng | yes |
Service Bus Namespace | sbn | yes |
Environment Codes
Environment | Code |
Development | dev |
Test | test |
System Integration Testing | sit |
User Acceptance Test | uat |
Staging | stag |
Pre-production | pre |
Production | prod |
Region Codes (Azure)
Geography | Country | Region | Code |
---|---|---|---|
Americas | USA | Central US | CUS |
Americas | USA | East US 2 | EUS2 |
Americas | USA | East US | EUS |
Americas | USA | North Central US | NCUS |
Americas | USA | South Central US | NSUS |
Americas | USA | West US 2 | WUS2 |
Americas | USA | West Central US | WCUS |
Americas | Azure Gov | West US,US DoD Central | WUSD |
Americas | Azure Gov | US DoD East | USDE |
Americas | Azure Gov | US Gov. Arizona | USGA |
Americas | Azure Gov | US Gov. Iowa | USGI |
Americas | Azure Gov | US Gov. Texas | USGT |
Americas | Azure Gov | US Gov. Virginia | USGV |
Americas | Azure Gov | US Sec East | USSE |
Americas | Azure Gov | US Sec West | USSW |
Americas | Canada | Canada Central | CC |
Americas | Canada | Canade East | CE |
Americas | Brazil | Brazil South | BS |
Europe | Europe | North Europe | NE |
Europe | Europe | West Europe | WE |
Europe | UK | UK South | UKS |
Europe | UK | UK West | UKW |
Europe | Germany | Germany North | GN |
Europe | Germany | Germany West Central | GWC |
Europe | Switzerland | Switzerland North | SN |
Europe | Switzerland | Switzerland West | SW |
Europe | Norway | Norway West | NW |
Europe | Norway | Norway East | NE |
Asia Pacific | Asia Pacific | East Asia | EA |
Asia Pacific | Asia Pacific | Southeast Asia | SA |
Asia Pacific | Australia | Australia Central | AC |
Asia Pacific | Australia | Australia Central 2 | AC2 |
Asia Pacific | Australia | Australia East | AE |
Asia Pacific | Australia | Australia Southeast | AS |
Asia Pacific | China | China East | CE |
Asia Pacific | China | China North | CN |
Asia Pacific | China | China East 2 | CE2 |
Asia Pacific | China | China North 2 | CN2 |
Asia Pacific | India | Central India | CI |
Asia Pacific | India | South India | SI |
Asia Pacific | India | West India | WI |
Asia Pacific | Japan | Japan East | JE |
Asia Pacific | Japan | Japan West | JW |
Asia Pacific | Korea | Korea Central | KC |
Asia Pacific | Korea | Korea South | KS |
Middle East and Africa | South Africa | South Africa North | SAN |
Middle East and Africa | South Africa | South Africa West | SAW |
Middle East and Africa | UAE | UAE Central | UC |
Middle East and Africa | UAE | UAE North | UN |
Since coming up with this scheme, Microsoft have published their own advice which you can find at
and detailed information on Naming rules and restrictions for Azure resources can be found at
https://docs.microsoft.com/en-gb/azure/azure-resource-manager/management/resource-name-rules