Author : MD TAREQ HASSAN | Updated : 2022/01/23
Best Practices
- An effective naming convention composes resource name from important information about each resource
- A well-chosen name helps to quickly identify the resource’s type and associated workload, deployment environment, etc.
- Resource name should be unique within the subscription
- Resource name should be precise and easy to understand
- Following same naming convention for entire organization
- Long words in the resource name should be abbreviated and small words would be used as it is
- Using names that are easy to read i.e., using word separating characters if possible/allowed
- Avoiding verbosity & very long names
Restrictions
There are certain restrictions that must be followed while creating Azure resources:
- Resource name can’t include % and can’t end with period “.” or space “ ”
- For VM machine, resource name can have up to 64 characters
- Network resources naming convention can have character length between 1-80 character which should consist of Alphanumeric, underscores, periods, and hyphens. It should start with alphanumeric. End alphanumeric or underscore
- Storage account name can have character length between 3-24 consist of lowercase letters and numbers
- Database Server name can have character length between 3-63 Lowercase letters, hyphens and numbers. Can’t start or end with hyphen
- While coming to Azure web services, certificates can have name length between 1-260. Can’t end with space or period and can’t use “\” as well
- In general, resources have name length (characters count) limit that varies for different resources
- Some resources must be uniquely named across entire Azure, for example domain name (i.e., “foo.com”)
- More details: https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules
Abbreviation for Resource Types
Resource Type | Abbreviation |
---|---|
Management Group | mg |
Resource Group | rg |
Virtual Network | vnet |
Express Route Gateway | ergw |
VPM Gateway | vpngw |
Azure Firewall Policy | afwp |
Azure Firewall | afw |
Application Gateway | appgw |
Virtual Machine | vm |
Public IP | pip |
Network Interface Card | nic |
Log Analytics Workspace | law |
Storage Account | sa |
Azure Container Registry | acr |
Key Vault | kv |
Private Endpoint | pep |
Azure Kubernetes Service | aks |
Azure SQL Managed Instance | sqlmi |
Network Security Group | nsg |
Route Table | rt |
Format
Use all lowercase letters to make it consistent because certain resources only allow lowercase letters.
(1)ResourceTypeAbbreviationー(2)Workload/Purposeー(3)SystemNameー(4)EnvironmentNameー(5)Regionー(6)Suffix
Examples
rg-main-hsystem-dev-japaneast
rg-microservice-hsystem-dev-japaneast
rg-microservice-hsystem-dev-japaneast-001
rg-microservice-hsystem-qa-japaneast
rg-microservice-hsystem-dr-japanwest
rg-webapp-hsystem-prod-japaneast
rg-webapp-hsystem-prod-japaneast-001
Explanation
- ResourceTypeAbbreviation:
- Short form of resource types
- https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-abbreviations
- Workload/Purpose
- What kind of workload will be hosted
- Purpose of the infrastructure
- SystemName:
- Name of the system
- What is the name of the whole solution that infrastructure is being created for
- EnvironmentName:
- Target environment
- Dev, QA, Prod, Dr etc.
- Region:
- In which region the resource will be created
- Japan East, Japan West etc.
- Optional suffix
- Suffix is optional
- Use suffix only if identical resources will be created in same region
- Example for usage of suffix: when you need multiple Azure SQL Managed Instance for same environment in the same region
Exceptions
- Management Group:
- Management group does not have to follow same convention as normal resource
mg-<system-name>
- Example:
mg-hsystem
(root),mg-hsystem-dev-qa
(under root management group and contains 2 subscriptions - Dev & QA)
- Subscription:
- Subscription does not have to follow same convention as normal resource
subscription-<system-name>-<environment>-<region>
- Example:
subscription-hsystem-dev-japaneast
,subscription-hsystem-dr-japanwest
- Storage Account:
samainhsystemdev
(no need for region forGZRS
orRA-GZRS
)- Lowercase letters and numbers, maximum 24 characters
- Azure Container Registry:
acrmainhsystemdev
(no need for region when secondary replica is used)- Alphanumerics, maximum 50 characters
- More details: https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules
Subnet Naming
- Use Pascal Case
- Example:
AksAppClusterSubnet
AksKafkaClusterSubnet
SqlMiSubnet
ApplicationGatewaySubnet
Mandatory subnet names
- Vitual Network Gateway (Express route or VPN) subnet name must be
GatewaySubnet
- Azure Firewall Subnet must be
AzureFirewallSubnet