Cloud Resource Naming Convention (Azure)

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 PartDescription
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 codeThis refers to the deployment environments. Such as Development, Test or Production.

Recommended codes are:

dev
test
sit
int
prod
region codeThis refers to the regional data centre that the resource is deployed to.

see the list below for Azure

Key Principles

  1. All names should be lowercase or Pascal Case (Camel Case with the first character uppercase) if allowed
  2. Use and update the tables below for short-codes
  3. Use hyphens when possible
  4. If no environment is specified in the name, then Production is assumed
  5. try and keep the name length concise
  6. Do not use any non URL safe charters anywhere
  7. Do NOT use any special characters at the start or end of the name
  8. 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 😉

ResourceCodeHyphens Allowed
Resource Grouprgyes
Application Serviceasyes
Container Registrycrno
Storage Accountstrgno
Data Factorydfyes
Function Appfuncyes
Azure SQL Serversqlyes
Virtual Machinevmyes
Virtual Networkvnetyes
Search Servicesrchyes
Web App Servicewayes
API App Serviceapiyes
Data Lake Storedslno
Network Security Groupnsgyes
Public IP Addresspipyes
Load Balancerlbyes
Availability Setlayes
Recovery Services Vaultvltyes
Key Vaultkvyes
DevTest Lablabyes
Application Service Planaspyes
Kubernetes Serviceaksyes
Local Network Gatewaylngyes
Virtual Network Gatewayvngyes
Service Bus Namespacesbnyes

Environment Codes

EnvironmentCode
Developmentdev
Testtest
System Integration Testingsit
User Acceptance Testuat
Stagingstag
Pre-productionpre
Productionprod

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

https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/naming-and-tagging

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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.