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.
Table of contents
First, I want to give you some generic information about naming in Azure:
- 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
- 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.
|Alpha-Numeric||Storage Account Name||Cannot have dash, dot|
|Azure Cloud||SQL Server Name, Storage Account Name||Must be unique across Azure not just subscription|
|Length||Search Service and Virtual Machines||2 to 15 characters|
|Lower Case||Storage Account Name||Cannot be upper characters|
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.
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.
|Europe||North Europe||West Europe||we (West Europe), ne (North Europe)|
|UK West||UK South||uk, uks|
To identified the business, in the URL we have also the abbreviation of the company.
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.
A list of some Azure services that can be identified by an abbreviation.
|Resource/Service||Short Code||Long Code|
|Public IP Address||pip||publicip|
|Network Security Group||nsg||Networksg|
|App Service Plan||asp||appplan|
Type of service
This define what kind of service is hosting in a particular resource
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.
This is an Azure (az) resource group (rg) located in North Europe (ne) for the project myproject in the developer environment.
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.