Azure Naming Tool: a fixed name for every resource
If you work with Azure, you make up names all day. For a resource group, a key vault, a storage account. Without a fixed convention, one team calls its storage storageprod2 and another st-webshop-prd. Microsoft’s Azure Naming Tool solves that. You define your naming convention once and the tool builds every name according to it.
How it works
You pick a resource type, a project or application, an environment, a region and an instance number. The tool puts those parts together and gives you the name. A key vault for the development environment in Australia Central then becomes, for example, kv-msc-dev-auc-1.
The abbreviations come from Microsoft’s Cloud Adoption Framework: kv for key vault, rg for resource group, vnet for virtual network.
The tool also knows Azure’s rules for each resource type. How long can a name be? Which characters are allowed? A Batch account, for example, may only contain lowercase letters and numbers. The tool then drops the hyphens: bamscdevauc1.
Try it
A public version runs at resourcenamegenerator.azurewebsites.net. Pick a resource type under Generate and you see right away how it works. Reference lists every resource type with its abbreviation and rules.
That version uses sample values. For your own organisation you want your own projects, environments and regions.
Run it yourself
The Azure Naming Tool is open source (MIT licence) and lives on GitHub. You can run it as an Azure App Service or as a container, for example. As an administrator you set:
- which parts go into a name, and in which order
- the values for each part, such as your own environments and regions
- the delimiter
- your own parts, such as a department
After that, your colleagues only pick from lists.
The API
Whatever you do on the web page, you can also do through the API. You send the short names of the parts to /api/ResourceNamingRequests/RequestName and get the name back. Every call needs an API key. As an administrator you find it in the tool.
{
"resourceType": "st",
"resourceProjAppSvc": "msc",
"resourceEnvironment": "dev",
"resourceLocation": "auc",
"resourceInstance": "1"
}
Of course you could also glue those values together yourself. What the API adds:
- One place for the convention. The order, the delimiter and the rules per resource type live in the tool, not in every script.
- Validation. The API rejects values that are not in the convention, such as
prodwhen it should beprd. A name that is too long or has invalid characters doesn’t get through either. - A log. You see which names have already been issued.
When does it pay off?
The tool pays off when many people create names: several teams, or colleagues who don’t write code. They pick on the web page, your pipelines get the same names through the API. When you change the convention, you do it in one place.
Do you work with one team and a simple convention? Then a naming function in your own Bicep or Terraform code is simpler. For Terraform there is the Azure Verified Modules naming module. You don’t have to run and secure an extra web app.
