I'm currently building a solution using Bicep and the Azure Developer CLI (azd). I've noticed that the official Bicep starter includes a JSON file for resource naming abbreviations, but it hasn't been updated in over a year and is missing lots of resources. The Azure Naming Tool is also outdated and doesn't provide a downloadable JSON file, so I'm stuck looking up abbreviations on the Microsoft documentation site, which isn't very convenient for me. I'm curious why Microsoft isn't keeping this information up to date and how others are managing naming conventions in their projects.
8 Answers
Azure Policy is definitely the way to go for managing this kind of thing. It gives you a solid framework for enforcing naming conventions across resources.
Maybe Microsoft is just trying to avoid breaking changes. Renaming resources often requires recreating them, which can be disruptive. I use my own naming module to avoid depending on external sources for something so critical.
I was experimenting with naming conventions a while back and made some user-defined functions for that. Check it out here: https://github.com/bigwhitesolutions/azure-naming/blob/AddFunctionsSupport/dist/naming.functions.bicep. I wish the JSON file could be updated based on this structure from @berndverst.
I think naming conventions should ideally be managed via Azure Policy. You can certainly deploy policies through Bicep scripts. Personally, I created a library of functions to handle resource naming and import that library into my main Bicep file. For example, I have a function like resourceNames.storageAccount(org, env, location, discriminator).
The real source for resource naming conventions is the OpenAPI spec. You can check it out here: https://github.com/azure/azure-rest-api-specs. That's where the most accurate information can be found.
Has anyone tried the AVM naming module for Terraform? What do you think?
I use those modules as templates to create my own. I prefer to keep it simple and minimize dependencies.
Are you talking about this AVM module? As far as I know, there’s no official one for naming yet. It’s concerning that the maintainer is the same person who abandoned the previous naming module.
I wonder why naming conventions matter so much. Sure, they look nice, but they can add a lot of complexity. What real benefits do they bring?
Yeah, I’ve used it and it works well for me!