azure,

Azure Naming Convention Best Practices

Sven Malvik Sven Malvik Connect Feb 02, 2021 · 3 mins read
Azure Naming Convention Best Practices

Structure helps us to be in control. That is very true also in Azure. Especially in larger organizations where many cloud engineers create, remove, update and delete (CRUD) resources all the time. One tool that supports us to keep control is Naming Standards. This post discusses this topic.

Keep it Simple, Stupid - KISS

Simplicity helps us to structure knowledge, ideas and thoughts better. When it comes to naming, I think short names supports this idea. Instead of having descriptive and somehow long names, I suggest short resource names. There might also be technical justifications. A Windows VM name has a maximum character limit of 15. Keeping it short and simple allows us to re-use the same logic regardless of resource type, location or service.

Use Prefix and Postfix

One option is to use prefix or suffix to add clarity to resource names. I’m a fan of having at least the following elements as part of a resource name: environment, resource type and workload. Another option is to use a suffix and a randomized string that is based on the resource group. Use tags complementary for context like environment, etc. This will help for resources which needs global unique names. As infrastructure as code is nowadays a common approach to manage resources, naming conventions are easy to implement. Get more details about how naming conventions can look like.

Policy

Azure Policies can help to ensure new Azure resources follow your naming conventions. Create policies that are scoped to resource types that will deny a deployment of a resource if a naming convention isn’t compliant to your policies. Here’s an example of a policy for VMs:

{
     "properties": {
         "displayName": "VM naming convention",
         "description": "Naming convention for VMs.",
         "mode": "All",
         "policyRule": {
             "if": {
                 "allOf": [
                     {
                         "field": "type",
                         "match": "Microsoft.Compute/virtualMachines"
                     },
                     {
                         "not": {
                             "field": "name",
                             "match": "az-???-##-vm" // ? for letters and # for numbers.
                         }
                     }
                 ]
             },
             "then": {
                 "effect": "deny"
             }
         }
     }
 }

More about Azure Policy

The above policy checks the Name if it matches the format az-???-##-vm, otherwise it will deny. The match pattern is defined using standard Azure Policy conditions.

Next steps

We use naming conventions to make life easier for us. The thing is that we can’t put all important information into a name. That’s where tagging can help. Adding metadata to resources will reduce the complexity of names and can be viewed complimentary to a naming convention. Tagging conventions can also be set as Azure Policy.

Join Newsletter
Get the latest updates right in your inbox. I never spam!
Sven Malvik
Written by Sven Malvik

Latest Stories

Event-Driven Infrastructure with App Configuration

Azure App Configuration is great for externalizing application configurations. But what if an application is our infrastructure? How coul...

Sep 12, 2020

Logging in Azure API Management

This post is a complete step-by-step guide on how to send logs from Azure API Management to Azure Event Hub with PowerShell. We start by ...

Apr 11, 2020

Understanding Policies in Azure API Management

Policies are the heart of Azure API Management. They let us change the behavior of our APIs in a very flexible manner. Before I dive in t...

Apr 18, 2020

Resource Tagging in Azure

Moving services from on-premise to Azure cloud requires effort, technical knowledge, and some experience to make a business secure, compl...

Aug 08, 2020

AZ-303 Self-Study Guide for Becoming an Azure Solution Architect

Microsoft updated it’s role based exam for AZ-300. It’s now called AZ-303 and launched last year. This certification is a great proof for...

Feb 01, 2021

How To Manage Azure Virtual Machines

I will go through the first steps for managing Virtual Machines. We will create a Windows VM, start the Internet Information Service IIS,...

Dec 26, 2020

Introduction to Azure API Management

Azure API Management (APIM) is a way to create consistent and modern API gateways for existing backend services. It provides an interface...

Jan 25, 2021

8 Actions to Cut Infrastructure Costs in 2021

8 Actions to Cut Infrastructure Costs in 2021 is the result of a research I did. I wanted to know more about the impact of the pandemic f...

Jan 10, 2021

Azure API Management with Terraform

Terraform is a popular tool for managing infrastructure resources. I counted about 120 supported providers. Azure is one of them. In this...

Apr 04, 2020

Serving Website Images from Azure CDN with SSL

In this post I will show you step by step how to serve images on a website from Azure CDN with SSL enabled. My blog has a couple of Azure...

Apr 25, 2020

Parameters in Farmer - IaC with Azure

This is part 2 of my learning adventure of Farmer for Azure resource deployments. This time, I wanted to look at parameters, variables, o...

Oct 10, 2020

Latest Stories

Event-Driven Infrastructure with App Configuration

Event-Driven Infrastructure with App Configuration

Azure App Configuration is great for externalizing application configurations. But what if an application is our infrastructure? How coul...

Sep 12, 2020

Logging in Azure API Management

Logging in Azure API Management

This post is a complete step-by-step guide on how to send logs from Azure API Management to Azure Event Hub with PowerShell. We start by ...

Apr 11, 2020

Understanding Policies in Azure API Management

Understanding Policies in Azure API Management

Policies are the heart of Azure API Management. They let us change the behavior of our APIs in a very flexible manner. Before I dive in t...

Apr 18, 2020

Resource Tagging in Azure

Resource Tagging in Azure

Moving services from on-premise to Azure cloud requires effort, technical knowledge, and some experience to make a business secure, compl...

Aug 08, 2020

AZ-303 Self-Study Guide for Becoming an Azure Solution Architect

AZ-303 Self-Study Guide for Becoming an Azure Solution Architect

Microsoft updated it’s role based exam for AZ-300. It’s now called AZ-303 and launched last year. This certification is a great proof for...

Feb 01, 2021

How To Manage Azure Virtual Machines

How To Manage Azure Virtual Machines

I will go through the first steps for managing Virtual Machines. We will create a Windows VM, start the Internet Information Service IIS,...

Dec 26, 2020

Introduction to Azure API Management

Introduction to Azure API Management

Azure API Management (APIM) is a way to create consistent and modern API gateways for existing backend services. It provides an interface...

Jan 25, 2021

8 Actions to Cut Infrastructure Costs in 2021

8 Actions to Cut Infrastructure Costs in 2021

8 Actions to Cut Infrastructure Costs in 2021 is the result of a research I did. I wanted to know more about the impact of the pandemic f...

Jan 10, 2021

Azure API Management with Terraform

Azure API Management with Terraform

Terraform is a popular tool for managing infrastructure resources. I counted about 120 supported providers. Azure is one of them. In this...

Apr 04, 2020

Serving Website Images from Azure CDN with SSL

Serving Website Images from Azure CDN with SSL

In this post I will show you step by step how to serve images on a website from Azure CDN with SSL enabled. My blog has a couple of Azure...

Apr 25, 2020

Parameters in Farmer - IaC with Azure

Parameters in Farmer - IaC with Azure

This is part 2 of my learning adventure of Farmer for Azure resource deployments. This time, I wanted to look at parameters, variables, o...

Oct 10, 2020