As enterprises start to utilize Azure resources, even a reasonably small footprint can begin to accumulate thousands of individual resources. This means that the resource count for much larger enterprises could quickly grow to hundreds of thousands of resources.
Establishing a naming convention during the early stages of establishing Azure architecture for your enterprise is vital for automation, maintenance, and operational efficiency. For most enterprises, these aspects involve both humans and machines, and hence the naming should cater to both of them.
It would be too naive and arrogant to propose a one-size-fits-all naming convention. Each enterprise has its own unique culture, tools, and processes. So, here are seven rules for scalable and flexible Azure resource naming conventions. To emphasize, these are rules for establishing naming conventions and not the actual naming convention itself.
Rule #1: Break them Up
- Breakup resource names into segments. Each segment may contain one or more characters to indicate a specific attribute of the resource.
- For example: Resource name cte2-sales-prod-rgp has four segments. First segment represents Contoso’s [ct] Enterprise’s, in East US 2 [e2], production [prod] Resource Group [rgp] for Sales application [sales]
Why This Rule: Logically partitioning resource names into segments allows for the comprehension of resource information by both machines and humans.
Rule #2: Make them Uniquely Identifiable
- Every resource should have a unique name. Meaning, a name should only belong to a singular resource. Do not hesitate to add additional segments to make the name unique.
- Ideally, the name should be unique globally across Azure, but if that is too hard to achieve, then at a minimum, it must be unique across all Azure Subscriptions under your Azure AD Tenant.
- For our Contoso example form Rule # 1, using a couple of characters that identify enterprise would increase chances for Azure wide uniqueness. For cte2-sales-prod-rgp, [ct] represents Contoso enterprise. Other segments, as explained in Rule # 1, also increases uniqueness.
Why This Rule: Following this rule will eliminate misidentification and resource name conflicts.
Rule #3: Make them Easily Recognizable
- Names must convey ordinary, but some critical pieces of information about the resource. This rule also serves as a backstop to Rule # 1, whereby taking Rule # 1 to an extreme, one might be tempted to use something like GUID to name the resource.
- The information may include Azure Region, Environment or Environment Category, Resource Type, etc. to name a few.
- For our Contoso example, each segment helps with the identification of Azure Region, Application, Environment, and Resource type. All good things for recognizing the resource.
Why This Rule: Following this rule will eliminate needing a lookup to get information, as the information is embedded in the name itself. Do not use random name generation such as GUIDs, as it might generate a unique name, but it would serve no other purpose.
Rule #4: Make Exceptions Obedient
- Some resources may not want to fit into the convention. For those resources, establish a convention for exceptions. Don’t let exceptions dictate the overall convention.
- For example: Storage account names cannot have non-alphanumeric characters. So, if your convention happens to use a dash to separate segments, don’t use the Storage account name and have a dash. Don’t drop a dash for all other resource names.
Why This Rule: Following this rule prevents a Convention that is too rigid and draconian, leading to convoluted and confusing names.
Rule # 5: Know When To Stop
- Initially, establish a naming convention for high-level resources and maybe one level deeper. Do not try to establish a naming convention for resources that are three, four, or five levels deep within a resource.
- If there is a need, let the convention for those lower levels be established by folks who have the expertise and happen to work with them daily.
- For example, establish a convention for Storage accounts, do not go too deep into naming Container, Blob, and Table.
Why This Rule: It is impossible to know everything about every resource type used by an enterprise. Leaving room for future extensions is essential for resilient and scalable naming conventions. Your future self and your colleagues will thank you for it.
Rule # 6. Keep Them Handsome, Pretty & Melodic
- Names created by convention should be pleasing to the eye and melodic to the ears. This means that you should pay special attention to following
- Segment sizes
- Juxtaposition of segments
- Sequencing of segments
- Go back to our Contoso example and see how you can improve so that it lives up to Rule # 6.
Why This Rule: You will live with the names for a long time and spend a lot of time with them. So you might as well make them a pleasure to work with.
Rule # 7: Toot Your Horn, But With Open Ears
- Document your convention where it is easily accessible and searchable such as a central Wiki. Present your convention at every opportunity. Demo real-life excellent and bad examples. Write blogs and make videos to explain.
- But, always keep an open mind. Listen to feedback and be open to refining when needed.
Why This Rule: Your established naming pattern is only as good as it’s last use. So practice, preach, persuade, push, peddle, profligate, pander but never be pedantic.
These rules have been battle-tested in several large enterprises over the past decade, so following these rules for flawless Azure Naming Convention.