Azure Resource naming convention guide

Microsoft Azure

The goal of this post is to offer a simple guide how to generate naming convention for Azure resource, bearing in mind some restrictions from Azure itself.

Naming Principals

First, I want to give you some generic information about naming in Azure:

  1. The naming pattern must support easy application level grouping for show back/charge back billing when required. Constraints: Some resources are constrained by their identifier length, and case sensitivity
  2. The convention MUST Describes type of resource in the subscription. Constraints: Some resources must be uniquely named across entire Azure.

The establishment of good name standard before you implementing different types of resources is imperative, as it can be difficult, or sometimes impossible to rename them afterwards.

Azure will try to automatically create various resources. For example, Virtual Machine Disks and Network Interfaces will still be named poorly. However, they can be named properly by using ARM templates, Powershell, Azure API or CLI.

It is unlikely that if we follow these rules for global naming that we will run into any naming conflicts with other Azure users. However, the chance still exists, so you need a strategy for coping with such conflicts (Not covered in this post).

Naming Limitations in Azure

Azure has a number of constraints, which are implemented at different scopes, and must be considered while naming resources. Most of them are documented under Microsoft’s Naming conventions documentation.

ScopeResourcesConstraint
Alpha-NumericStorage Account NameCannot have dash, dot
Azure CloudSQL Server Name, Storage Account NameMust be unique across Azure not just subscription
LengthSearch Service and Virtual Machines2 to 15 characters
Lower CaseStorage Account NameCannot be upper characters

Scoping

Each resource or service type in Azure enforces a set of naming restrictions and scope; any naming convention or pattern must adhere to the requisite naming rules and scope. For example, while the name of a VM maps to a DNS name (and is thus required to be unique across all of Azure), the name of a VNET is scoped to the Resource Group that it is created within.

Naming Identifier

An identifier can refer to different aspects that describe the particular resources and are eminent for building a good naming convention. Before building our resource naming scheme, we should write down some commonly used identifiers we can build our naming convention on.

Geographic Zones and Data centers

See Azure Paired Regions  for more information and a complete list of data centers.

GeographyPaired RegionsAbbreviation
EuropeNorth EuropeWest Europewe (West Europe), ne (North Europe)
UK WestUK Southuk, uks

Business

To identified the business, in the URL we have also the abbreviation of the company.

BusinessAbbreviation
N/A
My Companymcp
Common Projectcommon
Cross Projectcross

Environment

We have different environment setups and all should have their own abbreviation.

  • Production: This is live and is actively being used by customers. This is running on real data and exist on the azure production subscriptions.
  • Staging: This is a validation system that new features are evaluated in before final approval and roll-out to the production system. This is running on data as close to the reality as possible.
  • Testing: This is a system for trying out newly developed features that might not be fully completed. This is running on testing data.
  • Development: This is the playground for developing and explore new things on the Azure platform, and can be removed without further notice.
EnvironmentAbbreviation
Productionp
Stagings
Testingt
Developmentd

Azure Services

A list of some Azure services that can be identified by an abbreviation.

Resource/ServiceShort CodeLong Code
Subscriptionsubsub
Resource Grouprgrg
Virtual Machinevmvm
Availability Setavsavset
Virtual Networkvnvnet
Subnetsubsubnet
Public IP Addresspippublicip
Network Security GroupnsgNetworksg
Storage Accountstgstorage
Traffic Managertmtrafficmgmr
Load Balancerlbloadbalancer
Application Gatewayagwappgateway
Application Insightsaiappinsgt
App Servicesvcappsvc
Key Vaultkvkv
App Service Planaspappplan
SQL Databasesdbsqldatabase
SQL Serversqlsqlserver
Diskdskdisk
DNS Zonednsdnszone
Log Analyticsloaloganalytics
Logic Apploglogapp
Network Interfacenifnetinterface

Type of service

This define what kind of service is hosting in a particular resource

ServiceAbbreviation
Web Applicationwa
APIapi
Virtual machinevm

Resource naming

Finally, what you have been waiting for; The place where the debate temperature always rises.

Let’s establish some rules that can be used for almost all Azure resources:

  • Use lowercase
  • Use hyphens where permitted
  • Include the service name
  • Prefix/Suffix with Azure Service abbreviation
  • No spaces! Resource names should be made up of a minimum of 3 parts joined together without delimiters. There should not be any spaces in the resource name. Use hyphens where permitted!
  • Highly available resources should include an instance number.

Examples

azne-myproject-rg-d1
This is an Azure (az) resource group (rg) located in North Europe (ne) for the project myproject in the developer environment.

azne-myproject-app-wa-d1
This is an Azure (az) resource located in North Europe (ne) for the project myproject. This is an App Service (app) that contains a web application in the developer environment.

Azure Resource Name Generator

In conclusion, for this Azure Resource naming convention guide I have created a Microsoft Excel spreadsheet helps to generate the correct naming convention and you can download it from here.